[Linux-disciples] Negative Perl Regexp
Adam Rosi-Kessel
adam at rosi-kessel.org
Thu Jul 22 14:26:11 EDT 2004
This should be easy, but I've looked at perlre and am stuck.
Does anyone know how to make a regexp that only returns true if there is
no match in perl, assuming you don't have access to the surrounding code,
just the regexp?
In other words, I want to express
if (not /pattern/i) { print "yes!" } ;
But without the not, because I'm giving the regexp as a parameter to a
program.
I supppose I could do
/[^p][^a][^t][^t][^e][^r][^n]/
but this won't work if there are enough other characters not being
"pattern" such that this "negative" matches anyway.
Am I just being dumb here, or is there a good answer?
--
Adam Rosi-Kessel
http://adam.rosi-kessel.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20040722/5d36e1d9/attachment.pgp
More information about the Linux-disciples
mailing list