Beau E. Cox wrote:

>> Reading over Friedl's "Mastering Regular Expressions", and he gives a
>> problem on pp. 143-144 where a poorly formed expression takes
>> might-as-well-be-forever to finish.
>> 
>> I can't replicate the problem.
>> 
>> I'm using 5.8. Have they upgraded that problem away?
>> I wanted to duplicate the results as practice, but can't make the
>> pattern *ever* take so much as a whole second.
>> 
>> What am I doing right? :)
>> 
> 
> Interesting. Since I don't have the book, can you
> post a snippet as am example?

here is one(from Programming Perl) that takes "forever" to fail:

#!/usr/bin/perl -w
use strict;

$_ = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
/a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*[b]/;

__END__

the backtracking nature of Perl's reg. engine makes it forever to fail. 
generally, the solution will be using one of the reg. extension, 
negative/positive lookhead/lookbehind

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to