use Regexp::Common; s/.*?($RE{lingua}{palindrome}).*/$1/s;