But this should work:
if ($string =~ /(?$mod)$regex/) { ... } [download]
In reply to Re: configurable regex match by JavaFan in thread configurable regex match by Anonymous Monk