Page 1 of 1

Finding lines which start with the same word

Posted: Fri Oct 15, 2010 11:20 am
by gamores
I am trying to find search for lines in a document which start with the same word (preceded by a parenthesis). For example,

(robot,[N],[Device,Concrete,Count,Animate])
(robot,[N],[human,count])

so that I can delete duplicates.
The regular expression I am using is
(\([:word:]+\),.*\n^(\1

But it says it is not valid, and don't understand why :x

Thanks

Posted: Fri Oct 15, 2010 12:33 pm
by ben_josephs
The way TextPad's regex recogniser handles newlines is very weak. It doesn't allow a \n to be quantified with * or + or {m,n}, or to be contained in a parenthesised expression. And (the one relevant to your example) it doesn't allow a back-reference to refer back over a newline.