Re:Ruby takes 2min to match a regex
by srd on Wednesday February 12, 2014 @02:40PM
(#7226749)
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).
IIRC this was a pathological case with perl5.0 regexes as well.
Removing one of the redundant * or marking the grouping to be non-capturing with ?: seems to fix the problem.
Looks like the regex optimizer could use some love.
IIRC this was a pathological case with perl5.0 regexes as well.
Removing one of the redundant * or marking the grouping to be non-capturing with ?: seems to fix the problem.
Looks like the regex optimizer could use some love.