Re: [pcre-dev] Unexpected result when zero-length global mat…

Góra strony
Delete this message
Autor: ND
Data:  
Dla: Pcre-dev
Temat: Re: [pcre-dev] Unexpected result when zero-length global matching and pattern contains \G
>However, the match was for an empty string, so it moves on one character.
>


Explain please why an empty match causes move a starting offset by one
character.

I can imagine that starting offset need to move by one character if
    there is an empty match
       AND
    startoffset argument of this empty match is equal to ovector[0] (
So  startoffset == ovector[0] == ovector[1]


If ovector[0]==ovector[1] but ovector[0]>startoffset then there was a move
along subject string during the matching, and we don't need another move
by one character.


>
>
> In both cases, it finds a match one character later than the starting
> offset.
>
>


Philipp, the aim of my post was not to get a help on how this result
happens inside PCRE2 now. But to note that PCRE2 result in this situation
is not correspond with neither logical, nor Perl result. And so need to be
changed.
The fact that PCRE's "\G" have a difference from Perl's "\G" is not relate
to this situation IMHO.