Fix replacement bug in pcre2_substitute().
This commit is contained in:
parent
e8435bc006
commit
154bc83cb5
|
@ -72,6 +72,10 @@ but would not set (an example does exist), the test would "pass" without
|
||||||
actually doing anything. Also the fr_CA locale has been added to the list of
|
actually doing anything. Also the fr_CA locale has been added to the list of
|
||||||
locales that can be used.
|
locales that can be used.
|
||||||
|
|
||||||
|
14. Fixed a bug in pcre2_substitute(). If a replacement string ended in a
|
||||||
|
capturing group number without parentheses, the last character was incorrectly
|
||||||
|
literally included at the end of the replacement string.
|
||||||
|
|
||||||
|
|
||||||
Version 10.00 05-January-2015
|
Version 10.00 05-January-2015
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
|
@ -226,9 +226,9 @@ do
|
||||||
if (next >= CHAR_0 && next <= CHAR_9)
|
if (next >= CHAR_0 && next <= CHAR_9)
|
||||||
{
|
{
|
||||||
group = next - CHAR_0;
|
group = next - CHAR_0;
|
||||||
while (i < rlength - 1)
|
while (++i < rlength)
|
||||||
{
|
{
|
||||||
next = replacement[++i];
|
next = replacement[i];
|
||||||
if (next < CHAR_0 || next > CHAR_9) break;
|
if (next < CHAR_0 || next > CHAR_9) break;
|
||||||
group = group * 10 + next - CHAR_0;
|
group = group * 10 + next - CHAR_0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4075,6 +4075,18 @@ a random value. /Ix
|
||||||
|
|
||||||
/(?<=abc)(|def)/g,replace=<$0>
|
/(?<=abc)(|def)/g,replace=<$0>
|
||||||
123abcxyzabcdef789abcpqr
|
123abcxyzabcdef789abcpqr
|
||||||
|
|
||||||
|
/./replace=$0
|
||||||
|
a
|
||||||
|
|
||||||
|
/(.)(.)/replace=$2+$1
|
||||||
|
abc
|
||||||
|
|
||||||
|
/(?<A>.)(?<B>.)/replace=$B+$A
|
||||||
|
abc
|
||||||
|
|
||||||
|
/(.)(.)/g,replace=$2$1
|
||||||
|
abcdefgh
|
||||||
|
|
||||||
# End of substitute tests
|
# End of substitute tests
|
||||||
|
|
||||||
|
|
|
@ -13721,6 +13721,22 @@ Failed: error -34: bad option value
|
||||||
/(?<=abc)(|def)/g,replace=<$0>
|
/(?<=abc)(|def)/g,replace=<$0>
|
||||||
123abcxyzabcdef789abcpqr
|
123abcxyzabcdef789abcpqr
|
||||||
4: 123abc<>xyzabc<><def>789abc<>pqr
|
4: 123abc<>xyzabc<><def>789abc<>pqr
|
||||||
|
|
||||||
|
/./replace=$0
|
||||||
|
a
|
||||||
|
1: a
|
||||||
|
|
||||||
|
/(.)(.)/replace=$2+$1
|
||||||
|
abc
|
||||||
|
1: b+ac
|
||||||
|
|
||||||
|
/(?<A>.)(?<B>.)/replace=$B+$A
|
||||||
|
abc
|
||||||
|
1: b+ac
|
||||||
|
|
||||||
|
/(.)(.)/g,replace=$2$1
|
||||||
|
abcdefgh
|
||||||
|
4: badcfehg
|
||||||
|
|
||||||
# End of substitute tests
|
# End of substitute tests
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue