Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: "Minimal" matching isn't....

by Eimi Metamorphoumai (Deacon)
on Dec 19, 2005 at 21:13 UTC ( #517897=note: print w/replies, xml ) Need Help??


in reply to "Minimal" matching isn't....
in thread The "anchor" misnomer in regexes

I think part of the problem is the term "minimal" which gets used. "Greedy" is a good term for what * does normally--grab as much as possible and only give it up if you really have to. But the opposite behavior, the one for *? isn't minimal, it's lazy. Take as little as you possibly can, and move on. If you're backtracked into, then take another character. It's not optimizing for the smallest match, just for the first one it can find given its laziness.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2020-10-23 11:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (238 votes). Check out past polls.

    Notices?