Page 1 of 1

RegEx for searching all but a given token ?

Posted: Sun Sep 21, 2003 10:31 pm
by sergeant
Hello,

how I can search (using regular expressions) for lines, which do
not contain a given token.

For example, maybe I have several variables beginning int_var1.., int_var2.., ...Now I want to search all lines of the C-source, which do not contain int, something like [^(int)]_var.

Thanks for any hint!

Regards

Juergen

Posted: Sun Sep 21, 2003 11:32 pm
by Bob Hansen
I think the easiest method is to Mark All with int_var and then toggle the Marked Lines.
Try this for your hint:


1. Search, Find, Mark All for the following:
^int_var

2. Close Find Window

3. Search, Invert All Bookmarks

Works with/without POSIX format

Hope this is helpful.................good luck,
Bob

Posted: Sun Sep 21, 2003 11:35 pm
by s_reynisson
Std answer is here. Also, I googled around a bit and found this and the main result there is
the same:
To see why it is impossible to constuct a regex that matches
anything but another regex you have to look at how regexs work in
terms of DFAs and all that - and then think on it for a few
hours
Using TP you can find all lines containing your string, bookmark those lines and then invert them.

dogh! Bob beat me to it... :oops: