Finding lines without a word

Find, replace, find in files, replace in files, regular expressions

Finding lines without a word

Postby Quadko » Sat Aug 20, 2005 3:11 pm

I am trying to match full lines without a word (say, XYZZY in the example below) but am having trouble. (And I saw how to match lines without specific characters in other threads, but couldn't extend it to full words.)

Using ^.*XYZZY.*$ I can match lines with the word (lines 1 & 3) but I am having trouble negating that to get the opposite matches of lines 2 & 4.

1) Fred Tom XYZZY Jack Bob
2) Jack Bob Frank Fred Tom
3) Tom Jack Bob XYZZY Frank
4) Tom Jack Bob Frank Fred

Any recomendations or assistance?

(Using UE32 11.00+)
User avatar
Quadko
Newbie
 
Posts: 9
Joined: Thu Aug 18, 2005 11:00 pm

Re: Finding lines without a word

Postby Mofi » Mon Aug 22, 2005 12:37 pm

It is not possible to find lines which does not contain a specific word. As a workaround you can replace all lines which contain the word with nothing and as a result you will get all lines, which does not have this word.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4064
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Finding lines without a word

Postby Quadko » Tue Aug 23, 2005 4:22 pm

Thanks, Mofi! That will save me further beating of my head against the wall.

I can explore other options instead: replace word with unique char, or macros. Since at the moment I just want to delete the irrelevant lines, I know I can get these alternates working. I just thought I was missing some obvious regex trick.
User avatar
Quadko
Newbie
 
Posts: 9
Joined: Thu Aug 18, 2005 11:00 pm


Return to Find/Replace/Regular Expressions