$str = "SecureQuery(\$_GET)"; if ($str =~ m/^Secure(\w+)?\(\$_\w{3,4}\)/ig){ print $& . "\n"; }