Re: [pcre-dev] Multisegment match issue

Pàgina inicial
Delete this message
Autor: ND
Data:  
A: Pcre-dev
Assumpte: Re: [pcre-dev] Multisegment match issue
On 2013-02-02 22:44, ND wrote:
> Good day, Philip!
>Suppose input string 'abcd' must be matched against pattern '\Ac|e'.
> It's obviously that result must be 'no match'.
>But input string arrives not at once but by two chunks:
> 1. ab
> 2. cd
> Application attempts to match 'ab' with 'partial hard' option. No match detected.
> Then application attempts to match 'cd'. And it matched.
> And whole input string is erroneously matched.
>I don't know a way for application to correctly match multisegment strings against such patterns. May be some extra functionality can be added to PCRE.
> For example, a possibility to tell to PCRE that first symbol of input string is not a first symbol of whole string.
>Thanx.
>


I propose following solution: PCRE can treat '\A' as lookbehind with length=1. So PCRE_INFO_MAXLOOKBEHIND adjusts accordingly.