"William James" <w_a_x_man / yahoo.com> wrote in message 
news:1154045557.877418.140290 / p79g2000cwp.googlegroups.com...
> 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."

    This attitude is noted, below...


>> However, regular expression can get generated automatically
>
> Stop generating crappy regular expressions.

    This is easier said than done.  It can be very hard to write code that 
can specifically avoid generating pathological regexes, especially if you 
don't understand how regexes work.  Indeed, it would be nice if the regexp 
engine can do this for you.  After all, it is the job of the programming 
language to make programming easier for us, is it not?


>>                        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.

    While Roman Hausner obviously created this thread with a somewhat 
beligerent attitude, it is rarely wise to reply in kind.
    There is much merit in his suggestion to include this PERL regexp 
optimisation feature in Ruby...