in reply to Re: Split a string based on change of character
in thread Split a string based on change of character
You can use split:
s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e
my $string= 'AAABBBCCCDD'; my $i=0; my @words= grep $i=!$i,split /(?<=(.))(?!\1)/,$string; print join "\n",@words,'';
s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Split a string based on change of character
by ikegami (Patriarch) on Jul 28, 2007 at 15:02 UTC | |
by Skeeve (Parson) on Jul 28, 2007 at 15:28 UTC | |
by eyepopslikeamosquito (Archbishop) on Jul 29, 2007 at 02:43 UTC | |
Re^3: Split a string based on change of character
by eyepopslikeamosquito (Archbishop) on Jul 28, 2007 at 23:47 UTC |
In Section
Seekers of Perl Wisdom