Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Re: RE: Quantifiers in regular expressions

by Roy Johnson (Monsignor)
on May 19, 2004 at 20:25 UTC ( #354742=note: print w/replies, xml ) Need Help??

in reply to Re: RE: Quantifiers in regular expressions
in thread Quantifiers in regular expressions

Putting a ? on a quantifier that isn't variable-length is like having any color car you want, as long as it's black. There's no difference between a greedy and a non-greedy {5}.

A greedy quantifier will take as many characters as it can, and then start backtracking until whatever follows it matches. A non-greedy one will take as few characters as it can, and then take more until whatever is supposed to follow it is found.

The PerlMonk tr/// Advocate

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://354742]
[LanX]: Jeez .... UTF8 in my company is driving me crazy
[LanX]: seems like my boss has activated an extra UTF8 encoding such that my JSON stuff arives twice encoded in the browser ... oO
[LanX]: he loves to do this with regexes ...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2018-03-19 23:20 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (246 votes). Check out past polls.