Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by mcovic (Initiate)
on Aug 01, 2006 at 22:04 UTC ( #565094=note: print w/replies, xml ) Need Help??


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

Thank you all for you help. It just confirmed my suspicion that this was indeed a bug. The Version I have is 5.8.0. As for those who tried to explain why this regular expression is problematic, this regular expression is fine and was specifically designed to test this very specific thing. And there is a nice use of (X)* (where X is any other expression) because it gives you the last occurence of pattern X (at least in my version of perl).
  • Comment on Re^2: Strange result from "abbbbbc" =~ /(b)*?(b*?)c/

Replies are listed 'Best First'.
Re^3: Strange result from "abbbbbc" =~ /(b)*?(b*?)c/
by GrandFather (Saint) on Aug 01, 2006 at 22:15 UTC

    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
Re^3: Strange result from "abbbbbc" =~ /(b)*?(b*?)c/
by rodion (Chaplain) on Aug 02, 2006 at 01:32 UTC
    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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2022-08-15 04:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?