Req #46503 [Opn->Sus]: PCRE objects in addition to the existing functions
| From: | cmb@php.net | Date: | Mon, 01 Feb 2021 15:20:57 +0000 |
| Subject: | Req #46503 [Opn->Sus]: PCRE objects in addition to the existing functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-231866@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=46503&edit=1
ID: 46503
Updated by: cmb@php.net
Reported by: glideraerobatics at hotmail dot com
Summary: PCRE objects in addition to the existing functions
-Status: Open
+Status: Suspended
Type: Feature/Change Request
Package: PCRE related
PHP Version: 5.2.6
Block user comment: N
Private report: N
New Comment:
ext/pcre already caches compiled patterns, but clearly, an OOP API
would have further advantages. However, the details of that API
would need to be layed out and discussed as an RFC. Feel free to
start the RFC process[1]. For the time being, I'm suspending this
ticket.
[1] <https://wiki.php.net/rfc/howto>
Previous Comments:
------------------------------------------------------------------------
[2008-11-06 13:23:19] glideraerobatics at hotmail dot com
Description:
------------
Most (if not all) other languages (such as javascript, Perl using the qr// operator) that support
PCRE regular expressions have some means of creating pre-compiled PCRE objects.
These are very useful in that these objects can be passed around inside an application into
functions that require a valid regular expression as argument. Using a PCRE object, these functions
just have use the 'instance of' operator in order to make sure that the arguments are of
the correct type.
Pre-compiled PCRE objects can also boost performance in the sense that the expression is compiled
once where needed, used one or more times and then disposed of. Sounds similar to how SQL statements
are or should be used. I assume that PHP currently compiles and caches string type regular
expressions internally so in that case the only performance advantage will be the disposing of the
unused regexp.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=46503&edit=1