|
|
| go ahead... be a heretic | |
| PerlMonks |
What does it mean that regexps are greedy? How can I get around it?by faq_monk (Initiate) |
| on Oct 08, 1999 at 00:25 UTC ( [id://667]=perlfaq nodetype: print w/replies, xml ) | Need Help?? |
|
Current Perl documentation can be found at perldoc.perl.org. Here is our local, out-dated (pre-5.6) version:
Most people mean that greedy regexps match as much as they can. Technically
speaking, it's actually the quantifiers ( An example:
$s1 = $s2 = "I am very very cold";
$s1 =~ s/ve.*y //; # I am cold
$s2 =~ s/ve.*?y //; # I am very cold
Notice how the second substitution stopped matching as soon as it
encountered ``y ''. The
|
|