while(/(regex1)/gi || /(regex2)/gi || /(regex3)/gi) #### while() { (/(regex1)/i || /(regex2)/i || /(regex3)/i) && f($1); } #### while() { #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); }