Created attachment 1575214 [details] PHP test Description of problem: When trying to match against this valid pattern /([nesw'",\X])|((?:[0-9]+)(?:[\.][0-9]+)?(?:e[+-]?[0-9]+)?)|\s+/i in PHP will result in the following message: PHP Warning: preg_match(): Compilation failed: escape sequence is invalid. Version-Release number of selected component (if applicable): pcre2-10.33-2.fc30 PHP 7.3.5 (or 7.3.6 from remi). How reproducible: Always. Steps to Reproduce: 1. Install PHP (depends on latest pcre2-10.33-2.fc30). 2. In PHP, use preg_match o preg_split against the described pattern (or run the attached test). Actual results: PHP Warning: preg_match(): Compilation failed: escape sequence is invalid. Expected results: No error message. The pattern is valid. Additional info: Th problem seems to be in pcre2, on which PHP depends. It works with pcre2-10.32-9.fc30, broken in pcre2-10.33-2.fc30. PHP test attached.
The regular expression can be reduced to /[\X]/: $ printf '%s\n' '/[\X]/' | pcre2test PCRE2 version 10.33 2019-04-16 /[\X]/ Failed: error 107 at offset 2: escape sequence is invalid in character class And no, this is not a regression in PCRE2 since PCRE2-10.32 also refuses the expression: $ printf '%s\n' '/[\X]/' | ./pcre2test PCRE2 version 10.32 2018-09-10 /[\X]/ Failed: error 107 at offset 2: invalid escape sequence in character class This behavior is in line with PCRE2 documentation because \X escape sequence is not allowed in character classes. This "change" has already been reported in bug #1706742. Closing as a duplicate. See more details there. *** This bug has been marked as a duplicate of bug 1706742 ***