In response to an outage on Stack Overflow Rob Pike tweeted that regex parsing failure was avoidable and pointed toward a great post on regex complexity by Russ Cox. The version of perl in that post (5.8.7) is super ancient and in perl 5.10 the regex engine received a ton of optimization work and that optimization work has continued right through to the most recent release - 5.24.0.
Running the script above on 5.24.0 shows:
shadowfax:~ mallen$ time perl re.pl
match
real 0m0.099s
user 0m0.026s
sys 0m0.039s
If you're looking to explore, debug or optimize your perl regular expressions, let me strongly recommend Damian Conway's RegExp::Debugger You can still make pathological regular expressions of course but it's much more difficult than the patterns given in Russ Cox's post.