in reply to Matching double characters and insertion

Use a look-ahead to make sure you COULD match the repeated letter, but not actually advance in the string:
$str =~ s/(.)(?=\1)/$1x/g;

_____________________________________________________
Jeff japhy Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;