$re[0] = qr (.*(?!system))i; $re[1] = qr (system)i; $v[0] = "oneitem"; $v[1] = "anothersystem"; for $a (@v) { for $r (@re) { print "\nRegex: $r\tValue: $a\n"; if ($a =~ /$r/) { print "$a matches $r\n" ; } } } #### Regex: (?-xism:.*(?!system)) Value: oneitem oneitem matches (?-xism:.*(?!system)) Regex: (?-xism:system) Value: oneitem Regex: (?-xism:.*(?!system)) Value: anothersystem anothersystem matches (?-xism:.*(?!system)) Regex: (?-xism:system) Value: anothersystem anothersystem matches (?-xism:system)