alfie:~$ perl -ne 'while (m/\G[^x]*?x(.)(?=x)/g) {print $1;}' xaxbxcxdexfx abc