Page 1 of 1

RE, tags, and the newline

Posted: Wed Feb 19, 2003 6:18 pm
by David
Basically, I want to find all pairs of lines which start with the same letter. So I tried
^\([[:alpha:]]\).*\n\1
but it tells me it's an invalid regular expression, which I'm pretty sure is due to the \n (I remove it and it works, even if it doesn't return what I want)
Anyone know why this would be, or how I can make it work?

Re: RE, tags, and the newline

Posted: Wed Feb 19, 2003 9:02 pm
by Andreas
replace \n with a character or character combination not existing in your text, e.g. @@@. Also add @@@ at the beginning of the line.

then use
@@@\([[:alpha:]]\).*\@@@\1
instead.

When finished, remove first @@@, then replace @@@ by \n