On Fri, 15 Dec 2000 13:42:44 -0700, Kevin Walker wrote:
>Deven seems to be advocating thinking about regular expressions
>without worrying too much about the implementation, even at a fairly
>abstract level.
Here's a counter example:
/aaaabbbbccccdddddbbbbcdddd/
Shouldn't a non-greedy matcher /b.*?d/, according to the OP's rules,
match "bcd", the second matching string? That is shorter than the first
match. Oh, you want the first match. Well: same thing.
It is similar in nature to that question in comp.lang.perl.misc the
other day: why doesn't greediness force /a|ab/ to preferably match "ab"?
Because it doesn't. Try from left to right, first match wins. A dead
simple rule.
If Perl's greediness/nongreediness doesn't work for you, rely on
something else, to get what you want.
--
Bart.
- Re: Perl 5's "non-greedy" match... Jarkko Hietaniemi
- Re: Perl 5's "non-greedy" m... Nathan Torkington
- Re: Perl 5's "non-greedy" m... Deven T. Corzine
- Re: Perl 5's "non-greedy" match... Deven T. Corzine
- Re: Perl 5's "non-greedy" m... Jonathan Scott Duff
- Re: Perl 5's "non-greedy" m... Deven T. Corzine
- Re: Perl 5's "non-greedy" m... Kevin Walker
- Re: Perl 5's "non-greedy" m... Jarkko Hietaniemi
- Re: Perl 5's "non-greedy" m... Tom Christiansen
- Re: Perl 5's "non-greedy" m... Kevin Walker
- Re: Perl 5's "non-greedy" m... Bart Lateur
- Re: Perl 5's "non-greedy" m... Deven T. Corzine
- Re: Perl 5's "non-greedy" m... Tom Christiansen
- Re: Perl 5's "non-greedy" m... Deven T. Corzine
- Re: Perl 5's "non-greedy" matching ... Randal L. Schwartz
- Re: Perl 5's "non-greedy" match... Jeff Pinyan
- Re: Perl 5's "non-greedy" m... Deven T. Corzine
- Re: Perl 5's "non-greedy" m... Deven T. Corzine
- Re: Perl 5's "non-greedy" match... Deven T. Corzine
- Re: Perl 5's "non-greedy" m... Tom Christiansen
- Re: Perl 5's "non-greedy" matching can be TO... Randal L. Schwartz
