S
Simon Fairey
Why does the following not work unless I put foo before the (?!)
portion, I have strings and I want to match all strings (I know
nothing about the content of the strings) that don't contain a certain
phrase but I have to use a negative RE rather than negating a positive
RE
foreach(qw(foobar fooboo)){
print "Checking <$_>....";
if(/(?!bar)/){
print "Match\n";
}else{
print "No Match\n";
}
}
I'm reading the docs but can't find out something core about the way
regexps work
that I'm obviously missing that will explain why this fails?
Cheers
Si
portion, I have strings and I want to match all strings (I know
nothing about the content of the strings) that don't contain a certain
phrase but I have to use a negative RE rather than negating a positive
RE
foreach(qw(foobar fooboo)){
print "Checking <$_>....";
if(/(?!bar)/){
print "Match\n";
}else{
print "No Match\n";
}
}
I'm reading the docs but can't find out something core about the way
regexps work
that I'm obviously missing that will explain why this fails?
Cheers
Si