ID: 48432 Updated by: scott...@php.net Reported By: webmaster at adurosolutions dot com -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: CentOs PHP Version: 5.2.9 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. The manual clearly states we don't support this. Fairly obviously, PCRE does not support the (?{code}) and (??{code}) construction. However, there is support for recursive patterns. Previous Comments: ------------------------------------------------------------------------ [2009-05-30 07:56:15] webmaster at adurosolutions dot com Description: ------------ The (?{CODE}) regular expression has been in Perl since <= 5.005, and the PHP documentation for PCRE says that it's current as of 5.005. This functionality does not appear to be functional in PHP 5.2.9. Reproduce code: --------------- <? $pattern = '/^(?{ $d=0 })(?:\((?{$d++})|\)(?{$d--})(?(?{$d<0})(?!))|(?>[^()]*))*(?(?{$d!=0})(?!))$/'; $pattern_simple = '/^(?{$d=0})\(/'; $subject = '((I)(like(pie))!)'; echo "result: ".preg_match($pattern, $subject)."<br/>"; echo "result_simple: ".preg_match($pattern_simple, $subject)."<br/>"; ?> Expected result: ---------------- I'm not claiming that the regular expressions should produce a match, but they should compile and be evaluated, and thus return either a 0 or a 1. Actual result: -------------- Warning: preg_match() [function.preg-match]: Compilation failed: unrecognized character after (? or (?- at offset 2 in __FILE__ on line __LINE__ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48432&edit=1