[tpm] looking for a regex that returns true on no match
Fulko Hew
fulko.hew at gmail.com
Thu Mar 12 06:38:09 PDT 2009
I'm looking for a regex that returns true if there is NO match.
And it has to be inside the regex itself, and not via the control structure
outside of it.
(Whatever it is... it has to happen in between the delimiters.)
I.e. Ordinarily you might do:
if ($x =! /normal/) { print "not normal\n"; } else { print "normal\n"; }
In psuedo code what I'm looking for would be something like:
/!normal/
I tried a 'A zero-width negative look-ahead assertion' which sounded
like what I wanted, but my understanding must be wrong. I tried
perl -e '$_='normal'; if (/(?!normal)/) { print "not normal\n"; } else {
print "normal\n";}'
but that didn't work.
Any ideas? or am I missing something?
TIA
Fulko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20090312/a2ebfa0e/attachment.html>
More information about the toronto-pm
mailing list