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/
In reply to Re: regex substring negation
by johngg
in thread regex substring negation
by spx2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |