in reply to Faster regex to split a string into runs of similar characters?
If you want to match all 256 byte values, you'll need the /s modifier. I thought this would just be more correct, but it also happen to be slightly faster (4% on my computer), certainly because it's faster to match anything rather than check that the character is different from "\n".
Beside that, why are you using look-ahead assertions? Isn't /((.)\2+)/g stricly identical to your regex? I don't see a performance difference with that though, so maybe perl optimizes away the look-ahead.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Faster regex to split a string into runs of similar characters?
by BrowserUk (Patriarch) on Nov 21, 2016 at 10:43 UTC | |
by Eily (Monsignor) on Nov 21, 2016 at 10:50 UTC | |
by BrowserUk (Patriarch) on Nov 21, 2016 at 11:31 UTC |
In Section
Seekers of Perl Wisdom