diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index 9c11fee07..5991f95ce 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -2741,7 +2741,7 @@ the main compiling phase. */ #define PARSE_TRACKED_EXTRA_OPTIONS (PCRE2_EXTRA_CASELESS_RESTRICT| \ PCRE2_EXTRA_ASCII_BSD|PCRE2_EXTRA_ASCII_BSS|PCRE2_EXTRA_ASCII_BSW| \ - PCRE2_EXTRA_ASCII_POSIX) + PCRE2_EXTRA_ASCII_DIGIT|PCRE2_EXTRA_ASCII_POSIX) /* States used for analyzing ranges in character classes. The two OK values must be last. */ @@ -4233,7 +4233,7 @@ while (ptr < ptrend) } if (*ptr == CHAR_P) { - *xoptset |= PCRE2_EXTRA_ASCII_POSIX; + *xoptset |= (PCRE2_EXTRA_ASCII_DIGIT|PCRE2_EXTRA_ASCII_POSIX); ptr++; break; } @@ -4251,7 +4251,8 @@ while (ptr < ptrend) } } *xoptset |= PCRE2_EXTRA_ASCII_BSD|PCRE2_EXTRA_ASCII_BSS| - PCRE2_EXTRA_ASCII_BSW|PCRE2_EXTRA_ASCII_POSIX; + PCRE2_EXTRA_ASCII_BSW| + PCRE2_EXTRA_ASCII_DIGIT|PCRE2_EXTRA_ASCII_POSIX; break; case CHAR_J: /* Record that it changed in the external options */ diff --git a/testdata/testinput5 b/testdata/testinput5 index 864fd80c0..8b07495e7 100644 --- a/testdata/testinput5 +++ b/testdata/testinput5 @@ -2343,11 +2343,19 @@ \= Expect no match \x{660}\x{660}\x{660} +/\d(?-aD)\d(?aD)\d/utf,ucp,ascii_bsd + 999 + 9\x{660}9 + /\d(?a)\d(?-a)\d/utf,ucp \x{660}9\x{660} \= Expect no match \x{660}\x{660}\x{660} +/\d(?-aD)\d(?aD)\d/utf,ucp,ascii_bsd + 999 + 9\x{660}9 + # SPACES />\s+\s+[[:space:]]+\x{a0} \x{a0}< >\x{a0}\x{a0}\x{a0}< diff --git a/testdata/testoutput5 b/testdata/testoutput5 index 775236e7a..5f534be6b 100644 --- a/testdata/testoutput5 +++ b/testdata/testoutput5 @@ -5251,6 +5251,12 @@ No match \x{660}\x{660}\x{660} No match +/\d(?-aD)\d(?aD)\d/utf,ucp,ascii_bsd + 999 + 0: 999 + 9\x{660}9 + 0: 9\x{660}9 + /\d(?a)\d(?-a)\d/utf,ucp \x{660}9\x{660} 0: \x{660}9\x{660} @@ -5258,6 +5264,12 @@ No match \x{660}\x{660}\x{660} No match +/\d(?-aD)\d(?aD)\d/utf,ucp,ascii_bsd + 999 + 0: 999 + 9\x{660}9 + 0: 9\x{660}9 + # SPACES />\s+\s+[[:space:]]+\x{a0} \x{a0}< 0: >\x{a0} \x{a0}<