Regular Expression Help

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Mauri Piper

Regular Expression Help

Post by Mauri Piper »

I would like to use "Find in Files" to locate all the files that contain one word or phrase and another word or phrase. I have combed the Help files on how to use regular expressions and no doubt I have stared right at it and missed it, but how do I do this?

I'd also like to be able to mark or replace lines that contain one or more target words or phrases.

Mauri
Mark Schnitzius

Re: Regular Expression Help

Post by Mark Schnitzius »

Just search for

wordone\|wordtwo

in files with "Regular Expression" checked. You can click "Mark All" instead of "Find" to mark those lines that match.

You won't be able to replace/remove the whole line because you won't be able to match on the whole line -- you can't search across files for a carriage return (\n). You might be able to swing it with a macro though.
Mauri Piper

Re: Regular Expression Help

Post by Mauri Piper »

Thanks, Mark. That works great to find the files that have either word. Is there a way to find only the files that have both words?

Apologies in advance if you already answered this and I just missed it.

~Mauri
Andreas

Re: Regular Expression Help

Post by Andreas »

AFAIK not in one go.

Close all files.
Search in Files for the first word.
Open All

Now you have all files containing the first word.

Search for the second word, set the scope to "All Documents"
Mauri Piper

Re: Regular Expression Help

Post by Mauri Piper »

Thanks you for your help, Andreas and Mark :)

~Mauri
Post Reply