perl -e 'print map {++$count," : ",$_,"\n"}split /(?:a|b)+/,"a12cdabab"' 1 : 2 : 12cd