[pcre-dev] [Bug 1759] pcreposix: REG_NOSUB incompatible with…

Top Page
Delete this message
Author: admin
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 1759] pcreposix: REG_NOSUB incompatible with POSIX regex
https://bugs.exim.org/show_bug.cgi?id=1759

--- Comment #1 from Philip Hazel <ph10@???> ---
The PCRE POSIX wrapper is just that: it uses the POSIX calls, but ultimately
ends up running the PCRE engine. The PCRE_NO_AUTO_CAPTURE option does indeed
mean that back references cannot be used without explicitly enabling the
relevant capture by giving the group a name. The man page for regcomp says for
NOSUB: "Do not report position of matches." I decided (decades ago when the
POSIX wrapper was invented) that the nearest thing to this was
PCRE_NO_AUTO_CAPTURE. Perhaps that was wrong: maybe it should just have been
ignored.

Anyway, the PCRE 8.xx series (now at release 8.38) is in maintenance only mode,
and I do not think this is a bug. The current development 10.xx (PCRE2) series
exhibits the same behaviour. I have made a note to improve the PCRE2
documentation to mention this restriction, both for PCRE2_NO_AUTO_CAPTURE
itself and for REG_NOSUB in the POSIX wrapper.

I will think about changing the regcomp() behaviour in PCRE2 (but it's too late
for 10.21, which is currently in release candidate testing) so that it does not
set the PCRE_NO_AUTO_CAPTURE bit, but just ignores the nmatch and pmatch
arguments at match time. I think that would not break anything that currently
works, though it would mean that patterns with REG_NOSUB would be processed
differently, and their performance would differ (not capturing saves a bit of
processing - whether this is at all significant I don't know).

As for PCRE 8.xx, there won't be another release for at least 6 months, as 8.38
came out in November. I'm in two minds as to whether to do anything, as we are
trying to run down 8.xx and encourage people to move to the new API in 10.xx.

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