Let's guess that <i>Regular Expression Matching Can Be Simple And Fast</i> is relevant <a href="http://swtch.com/~rsc/regexp/regexp1.html" rel="nofollow">http://swtch.com/~rsc/regexp/regexp1.html</a>
The issue with the regex seems to be the nested * matcher in the last part, paired with the grouping: ([\/\w \.-]* )*
(whitespace added to re to circumvent italisizing by HN).<p>IIRC this was a pathological case with perl5.0 regexes as well.<p>Removing one of the redundant * or marking the grouping to be non-capturing with ?: seems to fix the problem.<p>Looks like the regex optimizer could use some love.
if you are using Ruby for any performance sensitive task, you are doing it wrong. Really. Even the die hard fans acknowledge they use it for the meta-magic-shiny-shiny rather than something that complete a given task in a reasonable timeframe.<p>Ruby is slow. Dynamic languages often are.