P is for Practical | |
PerlMonks |
Simple regex questionby Anonymous Monk |
on Oct 23, 2003 at 12:57 UTC ( [id://301569]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Howdy Monks
I'm suffering from a minor regexp mental breakdown: Given a string such as: "aaabbccccdd eee" Id like to split it so that each single character range is extracted: ( "aaa", "bb", "cccc", "dd", " ", "eee" ) I initially thought something like the following might be ok, but since (?:) prevents capturing, I can see that it won't work: split /((?:.)\1*)/ $string I'm sure the answer is staring me in the face, but there we go!
Back to
Seekers of Perl Wisdom
|
|