in reply to Multiple regex catches on a line

Its already been offered what to do to fix it. However, I have a suggestion to make it go faster. Instead of using alternation within the regex, use Perl's logical or outside of it. That is:
while(/(regex1)/gi || /(regex2)/gi || /(regex3)/gi)
You need the /g in this example even if you don't expect the same regex to appear on the same line multiple times. The advantage to this example is that it significantly(well,depending on the regex) cuts down on the amount of backtracking that is neccessary by the NFA machine. You could also take that out of the while loop, and do this:
while(<file>) { (/(regex1)/i || /(regex2)/i || /(regex3)/i) && f($1); }

(Only do this, though, if you only expect one regex per line)

The advantage to this situation is that, if needed, you can call specific functions(or do specific actions) on a per regex level. E.g., :

while(<file>) { #put a while around the regexes if there is multiple #regexes per line; aslo add a /g ( (/(regex1)/i && doSomethingForRegex1($1)) || (/(regex2)/i && doSomethingForRegex2($1)) || (/(regex3)/i && doSomethingForRegex3($1)) ) && still_do_a_general_func_if_needed($1); }