Re: [pcre-dev] match point reset bug?

Página superior
Eliminar este mensaje
Autor: Philip Hazel
Fecha:  
A: Craig Silverstein
Cc: pcre-dev
Asunto: Re: [pcre-dev] match point reset bug?
On Thu, 1 Oct 2009, Craig Silverstein wrote:

> We have this behavior:
>       // advance one character if we matched an empty string at the same
>       // place as the last match occurred


What Perl and pcredemo (and pcretest) do is first to check whether there
is a non-empty alternative match at the same point, before advancing by
one character.

> Likely so. It sounds complicated, though. :-) It would be best if
> someone who understood both what perl was doing, and C++, could make a
> go at any change, assuming one is needed.


Indeed yes. Any volunteers reading this???

I think the change might be needed in order to get Sheri's \K example
right. \K resets the "start of match" point to "here", so a pattern such
as abc\K matches "abc", but reports a match of the empty string at
offset 3. The example that started this all off was abc\K|def\K matched
against "abcdefghi". Replacing the matches with "-" should yield
"abc-def-ghi". I suspect your present code won't yield that, because it
will advance past "d" after the first change.

Philip

--
Philip Hazel