From: William James Date: 2006-07-28T09:15:11+09:00 Subject: Re: Slow regular expressions :( Roman Hausner wrote: > Caleb Clausen wrote: > > If you take out the first \s* (or move it outside the parens), the > > slowness goes away. That first \s* isn't needed. Another trick that > > may help here is changing the *'s to +'s. > > > > This is a case of pathological backtracking. Usually, these things are > > solved by carefully tuning the Regexp, rather than expecting the > > Regexp engine to fix it... > > > No. I.e., "No, I won't take out the first \s* (or move it outside the parens). No, I won't tune the regular expression. No, this isn't a case of pathological backtracking. No, I won't stop holding my breath until I turn blue." > I am not looking for help on regular expressions here and I know > that this particular expression could be optimized. No. This regular expression has been pessimized. > I also know that > some regular expressions with backtracking can get exponentially slow. > > However, regular expression can get generated automatically Stop generating crappy regular expressions. > or there > could be other reasons why an optimization a la perl is helpful. > > The example simply points out that ruby uses a strategy that does not do > the optimization that is present in perl. My question was, whether Ruby > is going to fix this. The arrogance. He refuses to listen to any advice about cleaning up his crap and then demands to know when someone is going to "fix" Ruby. I hope that Ruby doesn't start pandering to those who obdurately refuse to clean up their feculent waste.