http://qs1969.pair.com?node_id=565096


in reply to Re^2: Strange result from "abbbbbc" =~ /(b)*?(b*?)c/
in thread Strange result from "abbbbbc" =~ /(b)*?(b*?)c/

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