in reply to Regex to only show 2nd character of the same character in a string
My guess to your meaning would be:
print $2 while 'abccabbcabc' =~ m[(c).*?(\1)]g;; c c [download]
As for your purpose, that's beyond me. Care to enlighten us?