|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
Re: Re: most efficient regex to delete duplicate wordsby coolmichael (Chaplain) |
| on Aug 14, 2001 at 06:41 UTC ( #104666=note: print w/ replies, xml ) | Need Help?? |
|
I'm still in the process of learning regexes, but I would think that $strint=~s/(\w+)(?:\W\1)+/\1/g; would be a little faster, as you don't need to store the second parenthesis match thingy, and you don't need to match zero or more copies of the first match, you need to match one or more. Can someone please correct me or confirm this thought? Thanks. Michael PS: I've also been thinking about the /o modifier. Would this be a good place to use it?
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||