http://www.perlmonks.org?node_id=24775


in reply to Regex OR'ing

$var =~ /regex(catch_this)/ || $var =~ /.{0}/;

Regex always prefer matches early in the string. For two matches starting at the same point in the string, regex prefers the one matching elements leftmost in an alternation, where alternations early in the regex are more important than those later. To break ties here, the regex prefers longer matches (or shorter matches for non-greedy elements).

Whether my snippet of code is of any use to you probably depends on other details you didn't mention.