in reply to RE: How are we lazy?
in thread How are we lazy?
Actually, I think lazy has to be slower than a negated character class. Basically, either greedy or lazy quantifiers using the dot metacharacter are forced to back- or forwardtrack. That nasty little dot will match with anything that it can get its grubby little hands on and will cause the regex to "overshoot" which greatly increases the amount of necessary backtracking or forwardtracking.
With the character class, Perl creates what amounts to a seive. Characters which match (or don't match, in the case of a negated character class) pass through the seive. When we get a non-allowed character, it stops, period. There is no "tracking" which occurs afterwards to clean up.
|
|---|