Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add (?aT) for updating PCRE2_EXTRA_ASCII_DIGIT in pattern #307

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

carenas
Copy link
Contributor

@carenas carenas commented Oct 10, 2023

As a follow up for #223 and affecting [:digit:] and [:xdigit:]

@PhilipHazel
Copy link
Collaborator

The documentation says that PCRE2_EXTRA_ASCII_POSIX affects all POSIX classes, which implies that it should not be necessary also to set PCRE2_EXTRA_ASCII_DIGIT when you set PCRE2_EXTRA_ASCII_POSIX. I agree, though, that (?a should be able to set/reset PCRE2_EXTRA_ASCII_DIGIT independently. I guess it will have to be (?aT) as (?aD) is already taken for \d.

@carenas
Copy link
Contributor Author

carenas commented Oct 10, 2023

I guess it will have to be (?aT)

if tried with (?aG) originally but it would seem more logical to reuse the one that applies to all POSIX classes instead as shown by the proposed changes, since that behaviour had to be modified anyway.

FWIW we already discussed this before, but what I didn't realize then is that users of PCRE2_EXTRA_ASCII_DIGIT that are not using PCRE2_EXTRA_ASCII_POSIX might want to disable its effect somehow and before this change that wasn't possible.

@PhilipHazel
Copy link
Collaborator

I am confused. Setting (?aP) affects all POSIX classes, including digit and xdigit. When PCRE2_EXTRA_ASCII_POSIX (aka (?aP)) is set, PCRE2_EXTRA_ASCII_DIGIT has no effect. The use case for ...DIGIT is when you just want to restrain digits but let other classes be extended. What is lacking is a (?a setting that just sets/unsets ...DIGIT.

Affecting the definition of [:digit:] and [:xdigit:].

For consistency, also allow (?aP) to have a similar effect.
@carenas carenas changed the title Allow updating PCRE2_EXTRA_ASCII_DIGIT by (?aP) in pattern Add (?aT) for updating PCRE2_EXTRA_ASCII_DIGIT in pattern Oct 11, 2023
@PhilipHazel PhilipHazel merged commit 3046486 into PCRE2Project:master Oct 11, 2023
@carenas carenas deleted the xa branch October 11, 2023 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants