Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Simple regex question
by gmax (Abbot) on Oct 23, 2003 at 13:15 UTC | |
by QM (Parson) on Oct 23, 2003 at 15:22 UTC | |
by Anonymous Monk on Oct 23, 2003 at 13:30 UTC | |
|
Re: Simple regex question (ex.s)
by tye (Sage) on Oct 23, 2003 at 15:11 UTC | |
|
Re: Simple regex question
by tachyon (Chancellor) on Oct 23, 2003 at 13:26 UTC | |
by Anonymous Monk on Oct 23, 2003 at 13:35 UTC | |
by tachyon (Chancellor) on Oct 23, 2003 at 13:44 UTC | |
by Anonymous Monk on Oct 23, 2003 at 20:30 UTC | |
by tachyon (Chancellor) on Oct 23, 2003 at 13:41 UTC | |
|
Re: Simple regex question
by delirium (Chaplain) on Oct 23, 2003 at 14:43 UTC | |
|
Re: Simple regex question
by Anonymous Monk on Oct 23, 2003 at 20:50 UTC | |
by Anarion (Hermit) on Oct 24, 2003 at 08:26 UTC | |
|
Re: Simple regex question
by holo (Monk) on Oct 26, 2003 at 14:09 UTC |