Click to See Complete Forum and Search --> : RegEx - Nested ()'s


yitzle
01-31-2007, 07:19 PM
Can I do:
s/((\n{1,3}\.){3})\.\n{1,3}/\1/ # 3 times 1-3 numbers followed by .
to replace eg 123.4.56.7 with 123.4.56? Or would I use \2?

h0vis
02-05-2007, 09:21 AM
s/(.*)\.7$/$1/g

will drop the .7 off the end but I'm not sure that's exactly what you want or is it?

Hope this helps.

yitzle
02-05-2007, 10:32 AM
I suppose I could, in this case, just look for
s/(.*)\.\n{1,3}$/\1/
but I wanted to know if there was a way to use nested brackets.