Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Elegant way to split into sequences of identical chars?

by pKai (Priest)
on Nov 30, 2005 at 10:07 UTC ( #512894=note: print w/replies, xml ) Need Help??


in reply to Re^2: Elegant way to split into sequences of identical chars?
in thread Elegant way to split into sequences of identical chars?

ingenious!

And not only

elegant++
but also by far the fastest solution so far, provided Benchmark not lying to me.

Since it is also very compact already, we get the most compact variant so far with

/((??{'(.)\1*'}))/g

This is not as fast as the precompiled regex, of course, but still faster than the other snippets seen.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://512894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2020-01-24 04:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?