Syntactic Confectionery Delight | |
PerlMonks |
Re: Re: regular expressions - finding repeatsby ihb (Deacon) |
on Feb 27, 2003 at 20:45 UTC ( [id://239250]=note: print w/replies, xml ) | Need Help?? |
Here's a little attempt to optimize this code. (Not that it's worth optimizing like this since backreferences rule, but anyway... :)) The pattern can be extended to the line below, and as a bonus you get an even uglier expression. '(?=[A-E])(?:' . join('|',map($_ x 5, qw(A B C D E))) . ')' A side note that actually can be relevant: if you don't rebuild the pattern each time you'll save a lot. And if you use qr// or /o you'll be even happier, usually. ihb
In Section
Seekers of Perl Wisdom
|
|