From: php at linuxhosted dot net Operating system: n/a PHP version: 5.2.5 PHP Bug Type: Feature/Change Request Bug description: the pcre (preg_*) functions should be able to pre-compile regexps
Description: ------------ what I'm proposing is, adding a function (perhaps named preg_compile) that would accept 1 string parameter $pattern. the function would return a resource with the compiled pcre code which could be used anywhere in the other preg_* functions where a string for the pattern would be accepted. this way if you need to do 1000s of pcre matches of the same pattern(s) on different data, it would not require internally doing pcre_compile() over and over, saving very valuable cpu time. Reproduce code: --------------- <?php $pattern = preg_compile("/s[i1]mpl[e3] pattern here/i"); // returns a new type of resource if (preg_match($pattern, "simple pattern here")) // which can then be used anywhere the normal string pattern could be echo "pattern matches\n"; ?> Expected result: ---------------- well, obviously if this feature was added i'd expect to see: pattern matches Actual result: -------------- since this is not actually implemented i'd just get a fatal error :P -- Edit bug report at http://bugs.php.net/?id=43772&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43772&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43772&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43772&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43772&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43772&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43772&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43772&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43772&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43772&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43772&r=support Expected behavior: http://bugs.php.net/fix.php?id=43772&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43772&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43772&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43772&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43772&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43772&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43772&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43772&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43772&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43772&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43772&r=mysqlcfg