in reply to Split operator in perl
perl -e 'print map {++$count," : ",$_,"\n"}split /(a|b)+/,"a12cdabab"' 1 : 2 : a 3 : 12cd 4 : b
perl -e 'print map {++$count," : ",$_,"\n"}split /((?:a|b)+)/,"a12cdab +ab"' 1 : 2 : a 3 : 12cd 4 : abab
perl -e 'print map {++$count," : ",$_,"\n"}split /(?:a|b)+/,"a12cdabab +"' 1 : 2 : 12cd
|
|---|