Page 1 of 1

who needs negative find :-)

PostPosted: Fri Jun 08, 2007 5:03 pm
by bobkoure
If you're looking to use find (rather than a filter) to not see something, you could use the "not followed by" operator
For instance, if I'm in an ebooks group and I want to not see pdbs I could use
^(?!.*pdb)
which means "start of line" "not followed by" "any chars" then "pdb"
or in a movies/mpeg group, I could use
^(?!.*wmv)
to hide windows media files.

Probably not a big deal, just something I've been using for a bit and I thought maybe someone else might find it useful.

Oh - and, yes, (?!pdb.*)$ works the same way - and, actually, I'd use something more like ^(?!.*\.pdb)

edit: typo fixed

PostPosted: Sat Jun 09, 2007 7:21 pm
by nzzz
I have trouble trying to figure out new Regular Expressions.
I fill up the drop down list full of non-working expressions too fast.

Thanks for the tip.

I thought ^ was for Begins with, and ! was for NOT...

PostPosted: Sat Jun 09, 2007 7:53 pm
by richy99
download regex buddy or look at regex sheets, i found it helped for me

PostPosted: Sun Jun 10, 2007 8:39 pm
by Smite
I never got into using lookaheads, so this is very welcome news. We've had this question a lot, and evidently have been giving the wrong answer. :)

PostPosted: Fri Jun 15, 2007 11:14 pm
by bobkoure
I forgot to mention - because look-aheads (and look-behinds) are "zero width assertions" you can just "stack 'em up"
so, to not see both pdbs and libs
^(?!.*pdb)(?!.*lib)
or neither pdbs, libs nor pdfs
^(?!.*pdb)(?!.*lib)(?!.*pdf)
etcetera - see how I don't have to mess with any additional logic?