Ovid has asked for the wisdom of the Perl Monks concerning the following question:
I'm desperately waiting for the second edition of Mastering Regular Expressions to come out. Until that time, there's a minor regex question that puzzles me.
In MRE, Friedl wrote that \d\d is more efficient than \d{2} because the second forces the re engine to count the occurences (thus incurring extra overhead) and the first simply allows it to match each in turn. However, it seems that this is a simple optimization. Does anyone know if this has happened in the newer versions of the re engine? I feel that \d{2} is more clear and generally use it, unless I am forced to optimize.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just go the the link and check out our stats.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Regex optimizations
by tedv (Pilgrim) on Oct 25, 2000 at 00:14 UTC | |
by Ovid (Cardinal) on Oct 25, 2000 at 01:16 UTC | |
RE: Regex optimizations
by dchetlin (Friar) on Oct 25, 2000 at 01:13 UTC | |
Re: Regex optimizations
by japhy (Canon) on Oct 26, 2000 at 16:10 UTC |
Back to
Seekers of Perl Wisdom