Thanks for looking into this. Would you know the meaning of the following new code in the updated pcre2demo.3 file:
/* If the previous match was not an empty string, there is one tricky case to
consider. If a pattern contains \eK within a lookbehind assertion at the
start, the end of the matched string can be at the offset where the match
started. Without special action, this leads to a loop that keeps on matching
the same substring. We must detect this case and arrange to move the start on
by one character. The pcre2_get_startchar() function returns the starting
offset that was passed to pcre2_match(). */
else
{
PCRE2_SIZE startchar = pcre2_get_startchar(match_data);
if (start_offset <= startchar)
{
...
}
}
There is no pcre2_get_startchar() in PCRE1. It only exists in PCRE2. The description states that pcre2_get_startchar() returns the starting offset that was passed to pcre2_match(). But the starting offset appears to be "start_offset", so that doesn't make sense. Note that PCRE1 uses pcre_exec().
Would you know how I would reproduce this code in PCRE1?
Update: Right, I think pcre2_get_startchar() refers to ovector[1] but will need confirmation of that.