Re: [pcre-dev] 'Hard' partial matching don't work with some …

Top Page
Delete this message
Author: Philip Hazel
Date:  
To: ND
CC: Pcre-dev
Subject: Re: [pcre-dev] 'Hard' partial matching don't work with some assertions
On Sat, 28 Aug 2010, ND wrote:

> When I pass partial 'hard' option to pcre_exec() than I told to PCRE that
> subject string is incomplete and may be continued.


No, that is not how it works. The partial option tells PCRE that the
subject string MAY be incomplete, not that it IS incomplete. That is the
subtle difference. Please read the documentation sentence again:

  A partial match occurs if the end of the subject string is reached            
  successfully, but there are not enough subject characters to complete         
  the match.  


That is the ONLY criterion that is applied. It does not apply in your
case.

> And what reason is why PCRE successfully applied 'end of whole string'
> '\z' to incomplete string?


I'm afraid you have misunderstood the partial matching feature, as I
explained above. PCRE does not have a concept of "incomplete string".
It just deals with a subject string. The partial matching feature means
that it can return "this string partially matches the pattern" as an
alternative to "this string does (or does not) match the pattern". In
other words, the partial bit is about partial matching, not about an
incomplete (or partial) string.

Philip

--
Philip Hazel