Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Split a string based on change of character

by Anonymous Monk
on Jul 28, 2007 at 08:37 UTC ( #629268=note: print w/ replies, xml ) Need Help??


in reply to Re: Split a string based on change of character
in thread Split a string based on change of character

<Zoffix> eval: $_='zyxxaabbbcccccc'; push @a, $1 while s/((.)\2*)//;[@ +a] <_ZofBot> Zoffix: ['z','y','xx','aa','bbb','cccccc']

20070730 Janitored by Corion: Added code tags, as per Writeup Formatting Tips


Comment on Re^2: Split a string based on change of character
Download Code
Re^3: Split a string based on change of character
by Anonymous Monk on Jul 28, 2007 at 08:43 UTC
    Or even: $_='zyxxaabbbcccccc'; push @a, $1 while /((.)\2*)/g; Which doesn't destroy original data.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2015-07-05 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls