in reply to regex substring negation
my $string = q{the quick black fox}; my $substring = q{brown}; if ( $string =~ m{\A(?!.*\Q$substring\E).*fox} ) { print qq{Found a non-$substring fox\n}; } else { print qq{Match failed, $substring seen\n}; }
I hope this is of use.
Cheers,
JohnGG
Update: Typo, s/negatine/negative/
|
|---|