Re: [pcre-dev] Partial match at end of subject

Top Page
Delete this message
Author: ND
Date:  
To: Pcre-dev
Subject: Re: [pcre-dev] Partial match at end of subject
On 2019-07-13 11:44, ph10 wrote:
> In this case PCRE2 finds a *complete* match before it finds a partial
> match. The pattern says "assert we are at the end of the subject"; that
> is true. Then it says "end of pattern" - so it returns a complete match.
> It never gets the chance to consider a partial match.
>



PCRE2_PARTIAL_HARD is intended for multisegment matching. I think when
this option is set it means: this subject IS incomplete, it's only a
non-last part of a certain "entire" subject.
So "\z" should always be false when this option is set.
And there is no complete match in this situation. And /\z/ should return
"no match".


> The matcher only considers a partial match if it is at the end of the
> subject and *not* at the end of the pattern and the next pattern item
> requires a character to test.



If I right understand you, then you assume that next example must be
complete matched at the end of subject:

PCRE2 version 10.33 2019-04-16
/(?<=b)\z/
ab\=ph
Partial match: b
                <


But really PCRE output is a partial match. And I think it's correct.