Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Must do regex range quantifier { } as a greedy

by Anonymous Monk
on Jan 17, 2022 at 11:47 UTC ( [id://11140530]=note: print w/replies, xml ) Need Help??


in reply to Must do regex range quantifier { } as a greedy

https://perldoc.perl.org/perlre#Quantifiers

{n,m}+ Match at least n but not more than m times and give nothing back

  • Comment on Re: Must do regex range quantifier { } as a greedy

Replies are listed 'Best First'.
Re^2: Must do regex range quantifier { } as a greedy
by LanX (Saint) on Jan 17, 2022 at 12:05 UTC
    The relevant part is rather

    By default, a quantified subpattern is "greedy", that is, it will match as many times as possible (given a particular starting location) while still allowing the rest of the pattern to match. If you want it to match the minimum number of times possible, follow the quantifier with a "?"

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-25 19:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found