find () or not ()

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
ccmancio
Posts: 11
Joined: Tue Jun 05, 2007 6:54 pm

find () or not ()

Post by ccmancio »

I need find all lines that not contain "()" or not contain "abc"
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post 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
Post Reply