in reply to regex to match double letters but not triple or more

DB<83> $re= qr/(?:^|(.)(?!\1)) ([[:alpha:]]){2} (?!\2)/x DB<84> say join "\t", $_, $_ =~ $re for <{,x}AA{,A}{,y}> AA A AAy A AAA AAAy xAA x A xAAy x A xAAA xAAAy DB<85>

Edit

Just realized, in the end it's very similar to the last solution in Re: regex to match double letters but not triple or more.

But somehow it works for me...???

Updates
improved character class and tests

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery