http://qs321.pair.com?node_id=383351

debiandude has asked for the wisdom of the Perl Monks concerning the following question:

Hey. I have a string that contains data similiar to this: 'aaabbcdd'. I was trying to write write a regex that would match 'aaa' then 'bb' then 'c' and then 'dd'. That is, it would group together everything that is the same.

I figured I would have to use the lookahead operator to check to see if what he just matched matches what is next but I am not sure how to do this. Also I was planning on doing it in a while loop like this:

my $string = 'aaabbcddeef'; while($string =~ m/\w(?!patternthatworkd)/gi) { do stuff.... }

Thanks for any help