>>>>> "Anno" == Anno Siegel <> writes:
>> /Perl.*(?!PHP)/
Anno> No, your "wild cards" make short shrift with the look-ahead. Even if
Anno> there is a "PHP" after "Perl", it is always possible for ".*" to match
Anno> enough of the following string to make any "PHP" disappear, so the
Anno> negative look-ahead succeeds (doesn't see PHP). Take the ".*" into
Anno> the lookahead:
Anno> /Perl(.*?!PHP)/
Right, it's the difference between:
Can I find Perl, followed by some number of characters,
followed by something that isn't PHP?
versus
Can I find Perl, followed immediately by something that isn't
"some number of characters followed by PHP"?
Logic can be tough some times. Luckily, Regex are precise, and do
exactly what you tell them.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!