[pcre-dev] [Bug 2211] Possible bug in pcredemo when checking…

Pàgina inicial
Delete this message
Autor: admin
Data:  
A: pcre-dev
Assumpte: [pcre-dev] [Bug 2211] Possible bug in pcredemo when checking for an empty match with patterns involving \K in lookarounds
https://bugs.exim.org/show_bug.cgi?id=2211

--- Comment #5 from Philip Hazel <ph10@???> ---
(In reply to John Tattarakis from comment #4)
> Merry Christmas Philip! :D
>
> "(?<=\K.)" won't match the next try because the "ANCHORED" flag is set and
> that expression cannot match at the start.


Yes and no. The ANCHORED flag does not mean "Must match at start of subject";
it means "Must match at the first matching position, without any bumpalong."
These are only the same thing when the starting offset passed to pcre2_match is
zero. Consider this command:

pcre2demo -g "a|(?<=\K.)" "abcd"

The first time it matches "a". The -g causes it to look for further matches,
now calling pcre2_match() with a starting offset of 1. This time "a" does not
match so it tries the second branch and the match succeeds as before, with a
non-empty match. If you just try it again with ANCHORED and NOTEMPTY_ATSTART it
will again succeed, and thereby loop. At least, that is my analysis - I have
not tried this.
If you have a suitably patched pcre2demo (or even similarly patched pcredemo),
please try the above command so we can be sure. Merry Christmas to you too.

--
You are receiving this mail because:
You are on the CC list for the bug.