Re: Perl 5's "non-greedy" matching can be TOO greedy!
[email protected] (Tom Christiansen) Fri, 15 Dec 2000 13:38:53 -0700
| Newsgroups | perl.perl6.language.regex |
|---|---|
| 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