-
Notifications
You must be signed in to change notification settings - Fork 8k
ext/pcre: Add "/r" modifier #13583
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
ext/pcre: Add "/r" modifier #13583
Conversation
Adds support for "Caseless restricted" matching added in PCRE2lib 10.43 with the "r" modifier. This is `PCRE2_EXTRA_CASELESS_RESTRICT` in PCRE2. This is an "extra" option, which means it is not possible to pass this option as pcre2_compile() function parameter. This option is passed in a pcre2_set_compile_extra_options() call. Previously, these extra options are set at php_pcre_init_pcre2(), but after this change, it is possible to customize the options by adding bits to `eoptions` in pcre_get_compiled_regex_cache_ex(). The tests for this change are ported from upstream test suite[^1]. [^1]: PCRE2Project/pcre2@c13d54f6581#diff-8c8312e4eb2d35bb16485404b7b5cc0eaef0bca1aa95ff5febf6a1890048305c
arnaud-lb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
ndossche
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
| /* PCRE specific options */ | ||
| case 'A': coptions |= PCRE2_ANCHORED; break; | ||
| case 'D': coptions |= PCRE2_DOLLAR_ENDONLY;break; | ||
| case 'r': eoptions |= PCRE2_EXTRA_CASELESS_RESTRICT; break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might need to be done conditionally, break with --with-external-pcre with older pcre2 version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch; do you prepare a PR or do I?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feel free :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds support for "Caseless restricted" matching added in PCRE2lib 10.43 with the "r" modifier.
This is
PCRE2_EXTRA_CASELESS_RESTRICTin PCRE2. This is an "extra" option, which means it is not possible to pass this option as pcre2_compile() function parameter.This option is passed in a pcre2_set_compile_extra_options() call. Previously, these extra options are set at php_pcre_init_pcre2(), but after this change, it is possible to customize the options by adding bits to
eoptionsin pcre_get_compiled_regex_cache_ex().The tests for this change are ported from upstream test suite1.
Footnotes
https://github.com/PCRE2Project/pcre2/commit/c13d54f6581#diff-8c8312e4eb2d35bb16485404b7b5cc0eaef0bca1aa95ff5febf6a1890048305c ↩