Bug ID: 2511
Summary: Feature Request: PCRE2_SUBSTITUTE, option for getting
*just* the replacement of a single match
Version: 10.34 (PCRE2)
this as an extension to my bug 2488, which you already implemented, as I have
seen just today.
The function pcre2_substitute would be much more versatile, if it would be
possible to just "calculate" a single match/replacement, without doing the
actual replacement in the original string.
As an example I am referring to other libraries, e.g. boost/C++
boost::regex_format function (or its successors), see here:
A first step in this direction was bug 2488, i.e. reusing an existing match.
What is missing is to omit to copy the string before and after the match. As a
hack I implemented another option to achieve this: PCRE2_SUBSITUTE_MATCH_ONLY.
By using PCRE2_SUBSTITUTE_MATCHED and PCRE2_SUBSTITUTE_MATCH_ONLY, I can, if I
don't set the PCRE2_SUBSTITUTE_GLOBAL simulate something like
However the semantics is kind of weird (especially as I *can* set
PCRE2_SUBSTITUTE_GLOBAL) and my feeling is, that, API-wise, a specialized
function like pcre2_substitute_match which just calculates the replacement
string for a single match (given a already valid match) would be better.
What is you opinion?
You are receiving this mail because:
You are on the CC list for the bug.
## List details at https://lists.exim.org/mailman/listinfo/pcre-dev