http://www.perlmonks.org?node_id=1055589


in reply to regular expression inverse match NOT match?

There are two ways to do this. The first is to use an ordinary match and then negate the result:

if (!($string =~ /keyword/)) { print "match failed"; }

or:

unless ($string =~ /keyword/) { print "match failed"; }

The second is to use the negated binding operator !~:

if ($string !~ /keyword/) { print "match failed"; }

See perlop#Binding-Operators.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,