develooper Front page | perl.perl6.language.regex | Postings from December 2000

Re: Perl 5's "non-greedy" matching can be TOO greedy!

From:
Nathan Torkington
Date:
December 14, 2000 15:22
Subject:
Re: Perl 5's "non-greedy" matching can be TOO greedy!
Message ID:
14905.21875.85545.564424@prometheus.frii.com
Deven T. Corzine writes:
> I haven't even SEEN an example where the current behavior is actually
> preferable than my proposed behavior, have you?  (And I'd expect at least a
> FEW, though I suspect there are probably more counterexamples.)

I think the biggest problem with your idea is that it requires the
engine to keep looking even after it finds a match, to see if there's
another shorter match.  This would make *every* match much much
slower, potentially heatdeathoftheuniverse slower.

I like the current semantics because it's very easy to visualize the
engine acting on your instructions and stopping as soon as it finds a
match.  I am a programmer, and I prefer programs to descriptions.

Nat



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About