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

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

From:
Tom Christiansen
Date:
December 15, 2000 15:27
Subject:
Re: Perl 5's "non-greedy" matching can be TOO greedy!
Message ID:
5571.976922831@chthon
>Nice summary, but I'm not buying what you're selling in the elaboration.

Then you lose, because I am not allowed to disagree with you anymore.
And everyone else has already written you off.

And the answer to "what breaks if mimimal matching is overall but
maximal matching is local"--or even, "if we change it all"-- is
a zillion programs, including just about any progressive match:

    while (/.*?(\w+)=(\S+)/g) {
	push @{ $h{$1} }, $2;
    } 

I can't wait for that to match the rightmost one and then fail.  Bah.

>>/dev/null

--tom



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