Page 1 of 1

find () or not ()

Posted: Sat Jul 07, 2007 9:00 am
by ccmancio
I need find all lines that not contain "()" or not contain "abc"

Posted: Sat Jul 07, 2007 2:19 pm
by ben_josephs
I think you're saying that you want to find lines that do not contain the 2-character string () or do not contain the 3-character string abc. That is the same as lines that do not contain both () and abc.

Or do you want to find lines that do not contain () and do not contain abc? That is the same as lines that do not contain either () or abc.

In TextPad you can't directly search for text not matching an arbitrary regular expression. But you can bookmark lines not containing matching text in two steps: first bookmark the lines that do contain matching text; then invert the bokmarks.

To bookmark the lines that contain both () and abc:
Find what: \(\).*abc|abc.*\(\)

[X] Regular expression

Mark All
To bookmark the lines that contain either () or abc:
Find what: \(\)|abc

[X] Regular expression

Mark All
To invert the bokmarks:
Then Search | Invert All Bookmarks.

Both the regular expressions above assume you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax