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

2000-12-15 Thread Deven T. Corzine
On Thu, 14 Dec 2000, Nathan Torkington wrote: 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

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

2000-12-15 Thread Deven T. Corzine
On 14 Dec 2000, Randal L. Schwartz wrote: "Deven" == Deven T Corzine [EMAIL PROTECTED] writes: Deven I haven't even SEEN an example where the current behavior is Deven actually preferable than my proposed behavior, have you? (And Deven I'd expect at least a FEW, though I suspect there

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

2000-12-15 Thread Randal L. Schwartz
"Deven" == Deven T Corzine [EMAIL PROTECTED] writes: Deven What surprised me was how vigorously people would defend the Deven status quo, and insist on the correctness of the current Deven behavior without thinking it through. No, I thought it through quite completely. As have others. Deven

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

2000-12-15 Thread Randal L. Schwartz
"Deven" == Deven T Corzine [EMAIL PROTECTED] writes: Deven As for special-case rules, I believe that my proposed modification would Deven REMOVE a special-case semantic rule, at the cost of added complexity at the Deven implementation level. (The cost decision of whether that added complexity

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

2000-12-15 Thread Deven T. Corzine
On 15 Dec 2000, Randal L. Schwartz wrote: "Deven" == Deven T Corzine [EMAIL PROTECTED] writes: Deven As for special-case rules, I believe that my proposed modification would Deven REMOVE a special-case semantic rule, at the cost of added complexity at the Deven implementation level.

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

2000-12-15 Thread Deven T. Corzine
On Thu, 14 Dec 2000, Jeff Pinyan wrote: You could use my sexeger technique to get this behavior (possibly): $string = "aaabbbcccdddeee"; # regex to be reversed: /b(.*?)d/ $revstr = reverse $string; ($match) = $revstr =~ /d(.*?)b/; No, that doesn't quite work. It works when

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

2000-12-15 Thread Deven T. Corzine
On Thu, 14 Dec 2000, James Mastros wrote: On Thu, Dec 14, 2000 at 04:10:12PM -0500, Deven T. Corzine wrote: The crux of the problem is that non-greedy qualifiers don't affect the "earliest match" behavior, which makes the matches more greedy than they really ought to be. Right. We've

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

2000-12-15 Thread Deven T. Corzine
On Fri, 15 Dec 2000, Deven T. Corzine wrote: Not at all. I don't want it to keep looking after it finds the first match. I want it to make sure that match isn't unnecessarily long, if non-greedy matching was in use. Conceptually (I don't think this would be a good implementation), you

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

2000-12-15 Thread Jarkko Hietaniemi
Please give it a rest. I think everybody got it by now. Everybody understands how the current implementation works and what the semantics are, and you disagree with the current semantics. I think that's the end of story since changing current default semantics is simply not an option. We

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

2000-12-15 Thread Kevin Walker
"Deven T. Corzine" [EMAIL PROTECTED] writes: I've yet to see a concrete example of where the current behavior is helpful, What about matching C comments? ($first_comment) = $code =~ m!(/\*.*?\*/)!s; # (ignore issues with quoted strings in $code Works correctly under the current

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

2000-12-15 Thread Jarkko Hietaniemi
More generally, it seems to me that you're hung up on the description of "*?" as "shortest possible match". That's an ambiguous Yup, that's a bit confusing. It's really "start matching as soon as possible, and stop matching as soon as possible". (The usual greedy one is, of course, "keep

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

2000-12-15 Thread Deven T. Corzine
On 15 Dec 2000, Randal L. Schwartz wrote: "Deven" == Deven T Corzine [EMAIL PROTECTED] writes: Deven What surprised me was how vigorously people would defend the Deven status quo, and insist on the correctness of the current Deven behavior without thinking it through. No, I thought it

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

2000-12-15 Thread Tom Christiansen
More generally, it seems to me that you're hung up on the description of "*?" as "shortest possible match". That's an ambiguous Yup, that's a bit confusing. It's really "start matching as soon as possible, and stop matching as soon as possible". (The usual greedy one is, of course, "keep

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

2000-12-15 Thread Tom Christiansen
Have you thought it through NOW, on a purely semantic level (in isolation from implementation issues and historical precedent), I've said it before, and I'll say it again: you keep using the word "semantic", but I do not think you know what that word means. --tom

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

2000-12-15 Thread Deven T. Corzine
[I delayed responding to this message because it was the longest.] On Thu, 14 Dec 2000, Tom Christiansen wrote: No question that's how it's been implemented. But WHY would anyone want such behavior? When is it beneficial? It is beneficial because this is how it's always been, because it