$_ = '... ... foo'; if (m{^(?! .*? foo ) .*? }sx){ print "Match\n"; } # no match