in reply to Split: Having your capitals and not eating them
Capturing what you split upon will return the split boundaries:
perl -le 'print $_ for split( /([A-Z])/, shift)' AbcDefGhi A bc D ef G hi
Note that edan's solution does something slightly different:
% perl -le 'print $_ for split( /(?=[A-Z])/, shift )' AbcDefGhi Abc Def Ghi
Choose your poison :)
- another intruder with the mooring of the heat of the Perl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Split: Having your capitals and not eating them
by tachyon (Chancellor) on Nov 11, 2004 at 13:47 UTC | |
by edan (Curate) on Nov 11, 2004 at 14:39 UTC | |
by tachyon (Chancellor) on Nov 11, 2004 at 14:49 UTC | |
by loris (Hermit) on Nov 12, 2004 at 08:08 UTC |