A dear friend of me asked me for a very special regular
expression problem, which I tried to solve. It goes like
this:
He needs to extract every character that resides between
two x in a string. So that would make xaxlxfxixex -> alfie.
Now the problem is, that it should also work with x
inbetween. So I tried a little here and there, and the best
I could came up with is the following:
So, I am missing the f in the output... So, what happened here? I'm slightly confused. Thanks for any hint you can offer.alfie:~$ perl -ne 'while (m/\G[^x]*?x(.)(?=x)/g) {print $1;}' xaxbxcxdexfx abc
In reply to special regexp by alfie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |