Page 1 of 1

Find - except for...

Posted: Wed May 01, 2002 4:12 pm
by cj
Is there a way to use TextPad to find all files (using "Find in Files") to do a text search for a text string, unless the line that contains that text string contains a different specific string.

For example, lets say you have two files you wish to search. One file contains a line of text "The big BROWN wolf jumps tall fences" and the other file contains a line of text "The big GRAY wolf jumps tall fences".

What I want to do is find all files that contain the line of text "wolf jumps tall fences" with the exception that the file not contain that line of text with the word "GRAY". (ie "wolf jumps tall fences" but not GRAY)

Is there a regular expression that would search all occurences with excpetions?

Thanks...

Re: Find - except for...

Posted: Wed May 01, 2002 7:43 pm
by Roy Beatty
Find: [^g][^r][^a][^y] wolf jumps tall fences

The above satisfies the literal version of your requirement. It will find expressions where the first four characters are not "gray".

It will *not* find "wolf jumps tall fences" occurring at the beginning of a line. Perl's lookahead regex would, but TextPad's regex engine lacks this feature.

I thank my "regular" friends for letting me have first crack at this puzzle!

Roy

Re: Find - except for...

Posted: Thu May 02, 2002 6:09 am
by Jens Hollmann
Only because the first of may is a public holiday here :-)

I can't think of something better though. The next step for me would be to write a short DOS-script with consecutive calls of findstr (or grep if you have it).

Jens

Re: Find - except for...

Posted: Thu May 02, 2002 5:55 pm
by cj
Thank you for your responses...

I remember the dos version of Multi-Edit having some sort of string search exception handling, but I don't recall how it worked. Seems to me that there was an option box that you would check (on the search form) in order to to search an entire line at a time for a word or phrase in that line. If you entered an exception, it would only return a successful search if that line did not contain the exception...

Is there some sort of a layman's tutorial on how to write a dos-script that would interact with TextPad?