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

Pàgina inicial
Delete this message
Autor: ph10
Data:  
A: ND
CC: Pcre-dev
Assumpte: Re: [pcre-dev] Unexpected result when zero-length global matching and pattern contains \G
On Sat, 30 Jun 2018, ND via Pcre-dev wrote:

> I'm surprised: is there another algorithm of working /g in pcretest in
> comparing with PCRE2_SUBSTITUTE_GLOBAL in pcre2_substitute()?


Sorry, my bad. I had forgotten about PCRE2_SUBSTITUTE_GLOBAL. You are
right.

> Sorry for my bad English. A want to ask: aren't
>   /g in pcretest
>      and
>   pcre2_substitute() with PCRE2_SUBSTITUTE_GLOBAL
> use the same algorithm?


Yes, they should be.

> I wonder that repeat return of the same match string as previous but at
> another point in the subject is interpreted as error. Why? I think it
> shouldn't.


If you don't treat it specially, you would get TWO substitutions at the
same point.

I have thought of a way of changing pcre2test but I have not tried it
yet. Maybe later today, or tomorrow... If it works, I will then look at
PCRE2_SUBSTITUTE_GLOBAL.

Philip

--
Philip Hazel