"jerry gay" <[email protected]> writes:
> On Fri, Jan 9, 2009 at 13:16, Eirik Berg Hanssen
> <[email protected]> wrote:
>> That doesn't look very "eager" to me.
>>
> it's "eager" for the match to close, which is the opposite of "greedy"
> matching. in perl 5 documentation, it's called "non-greedy". for use
> and explanation of the terminology, see
> http://perlcabal.org/syn/S05.html#Backtracking_control.
> ~jerry
If that's now the case, that's unfortunately confusing. In other
contexts, "eagerness" is "leftmost" ("eager" for matching to start, if
you like), which is orthogonal to "greed":
# Perl Cookbook illustration of eagerness, expanded to demonstrate
# that the non-greedy case is equivalent:
$string = 'good food';
if ($greedy) {
$string =~ s/o*/e/; # 'egood food'
}
else {
$string =~ s/o*?/e/; # 'egood food'
}
Why not stick to "non-greedy", if that's what you mean? Surely
that's not ambiguous?
Eirik
--
The basic facts are that the rate of decrease of the population growth
rate has been falling for decades, at an ever increasing rate.
[email protected] (John R. Snead)