Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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 pondering the Monastery: (3)
As of 2019-05-25 04:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (151 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!