Auteur: ND Date: À: Pcre-dev Sujet: Re: [pcre-dev] Partial match at end of subject
On 2019-07-23 20:20, ND wrote: > On 2019-07-22 17:32, ND wrote:
>>Now it can be useful to try putting into words, what exactly in
> applying > to multisegment matching means "local no match" and what
> means "partial > match".
> >
>Doc's says:
> A partial match occurs during a call to pcre2_match() when the end of
> the subject string is reached successfully, but matching cannot continue
> because more characters are needed, and in addition, either at least one
> character in the subject has been inspected or the pattern contains a
> lookbehind, or (when PCRE2_PARTIAL_HARD is set) the pattern could match
> an empty string.
>So docs says what exactly we decide to name a "partial match". But WHY
> we want to name "partial match" this strange complex thing? What
> practical or logical basis is under that?
>/x/
> ab\=ph
> No match
>/(?=x)/
> ab\=ph
> Partial match:
>/(?<=x)?y/
> ab\=ph
> Partial match:
>For example, WHY we want to define first as nomatch while second and
> third as partial?
> It's unobvious thing.
>
I think we can do yet little step and say that partial hard match occurs
always when the end of the subject string is reached, but matching cannot
continue because more characters are needed.
In terms of multisegment matching this may be say: partial hard match
occurs when current segment is not last and it's content not enough to
exactly determine, what match (or nomatch) would have WHOLE subject from
this start position.
So first example also is a partial hard match.
And it's not breaking change.