It's not evident that that is a "nice use if (X)*" given that different versions of Perl handle the rather bogus expression differently. The same result can be achieved using zero width assertions:
"babbbbbcbbbcx" =~ /(?:b)(?!.*b)(..)/;
print ">$1<\n"; # >cx<
Update s/\Q(?!(?=.*b))\E/(?!.*b)/. Thanks to ikegami for pointing out the redundancy.
DWIM is Perl's answer to Gödel
| [reply] [d/l] |
How much different it would have been to have this background information in the original post, where it would have helped us figure out how to be of help, instead of puting our work into gueses of what was needed.
With this statement showing up afterward like this, with the "yes, yes just as I thought" tone, I'm feeling less like I've been of help, and more like I've been mislead for someone's amusement.
Oh well, win some, lose some. | [reply] |