For a regular expression to match at all, it does not matter whether the regex engine or the regex subexpressions are greedy or nongreedy. Both will give up or match more if that's neccessary to make the whole match succeed. If you care about how the regular expression matches, greedyness becomes an issue:
for (<DATA>) { print "Greedy: $1/$2\n"; if /^(a+)(a+)$/; print "Non-greedy: $1/$2\n"; if /^(a+?)(a+)$/; };
In reply to Re: Is greediness irrelevant when matching whole lines?
by Corion
in thread Is greediness irrelevant when matching whole lines?
by loris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |