Szerző: ND Dátum: Címzett: Pcre-dev Tárgy: Re: [pcre-dev] several messages
Thanks a lot for clarifying docs and for your patience with me.
On 2019-06-21 16:18, ph10 wrote: > On Mon, 17 Jun 2019, ND via Pcre-dev wrote:
>> Second of my little concern is that "X*\z" and "X*" both matches and
>> matches
>> are different.
>> I understand why it is from procedural point of view. Know that is
>> Perl-compatible. But from logical point of view is quite unnaturally. > Not everybody has the same logic. :-) Here is another example where
> adding \z changes the outcome:
May be we don't understand each other. I say not about that removing "\z"
from any successfully matched pattern must not change resulting match ("."
not equal ".\z" of course). But about patterns with greedy "0 or more" or
"1 or more" quantifiers only.
Successfull match of "X*\z" means that PCRE says: X CAN be successfully
repeated until the very end of subject (let's the match is "abc" for
example).
When we use "X*" we want to say: repeat X as much as it can. From previous
sentence we know that X CAN be repeated until the very end of subject. So
we expect matching "abc" too. But now PCRE says that match is "a" (in
other words PCRE says: "X CAN'T be repeated until the very end of
subject"). This contradicts with our expectations.