[php-src] PR #23868: [Prototype] pcre: add Regex\CompiledRegex class for compiling regular expressions
| From: | Girgias | Date: | Wed, 23 Sep 2026 18:41:08 +0000 |
| Subject: | [php-src] PR #23868: [Prototype] pcre: add Regex\CompiledRegex class for compiling regular expressions | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38750@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23868
Author: Girgias
This is a prototype as I'm not really a fan of the approach in https://github.com/php/php-src/pull/22797.
This is a new class which is an opaque object, as I don't want to spend time figuring out how
to design an OO API right now, that compiles and validates a regex with the given options, and
throws on errors.
I've only added support to use this new class to
preg_split and
preg_grep until people think this approach is useful.
Note: this class only supports UTF-8 patterns on never depends on the local for character tables,
moreover the PCRE2_DOLLAR_ENDONLY compilation option is set by default as it is IMHO
the most sensible default behaviour, and if one wants to deal with multiple lines
PCRE2_MULTILINE must be set via the named argument.