in reply to regex substring negation

If you mean that you only want the match to succeed if a string doesn't contain a substring you could use a negative look-ahead.

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/