$_ = 'xaxbxcxdexfxxxx'; print $1 while /x(.)(?=x)/g; # abcfx