Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: Strange result from "abbbbbc" =~ /(b)*?(b*?)c/

by GrandFather (Saint)
on Aug 01, 2006 at 22:15 UTC ( [id://565096]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://565096]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-03-28 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found