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

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

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
December 15, 2000 12:39
Subject:
Re: Perl 5's "non-greedy" matching can be TOO greedy!
Message ID:
23395.976912733@chthon
>I meant that I've never seen
>a concrete, realistic example where the current behavior is more beneficial
>to the programmer than my proposed behavior.  

Absense of evidence is hardly evidence of absence.

   `cat /vmunix` =~ /\w+/

I just love guaranteed worst-case behavior.  NOT.
It is good to short circuit.  Very good.

>(I imagine in most cases, it
>will be a moot point, since the match will usually be the same.)

Then why the bloody blazes are you arguing about this so vociferously?

>Strange argument.  Greedy matching was once considered fundamental to the
>design of regex, and the "leftmost" behavior is 100% consistent with greedy
>matching.  

Nope.  These are orthogonal, unrelated concpets.

>Yet Perl 5 added non-greedy modifiers, changing a fundamental
>aspect of every preceding regex system, and still called it a regex...

Whether a match should be minimal or maximal in no way changes
whether the language is to be deemed "regular" by the proper
definition of that term.  Back-references, which have been in Perl
since its inception, suffice to disqualify the language from that
category, but minimal and maximal alternation do not.  But this
doesn't matter.

--tom

Thread Previous | Thread Next


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