#46904 [Opn->Csd]: preg_match() example #4 is wrong

From: Date: Sat, 12 Sep 2009 06:57:15 +0000
Subject: #46904 [Opn->Csd]: preg_match() example #4 is wrong
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2769@lists.php.net to get a copy of this message
ID: 46904 Updated by: torben@php.net Reported By: joe at digg dot com -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Debian GNU/Linux PHP Version: Irrelevant New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2009-09-12 06:55:14] svn@php.net Automatic comment from SVN on behalf of torben Revision: http://svn.php.net/viewvc/?view=revision&revision=288276 Log: Document that since PHP 5.2.2, named subpatterns accept the syntax (?<name>) and (?'name') as well as the older (?P<name>). Addresses bug #46904. ------------------------------------------------------------------------ [2008-12-23 19:31:59] philip@php.net And for good measure, here's a partial PCRE History in PHP (from changelogs): 5.0.0: 4.5 5.0.5: 5.0 5.1.0: 6.2 5.1.3: 6.6 5.2.0: 6.7 5.2.2: 7.0 5.2.4: 7.2 5.2.5: 7.3 5.2.6: 7.6 5.2.7: 7.8 4.4.9: 7.7 ------------------------------------------------------------------------ [2008-12-23 19:21:44] felipe@php.net Yes, It's expected. But Ok, we should specify a PCRE minimum version, 7.0 (bundled as of PHP 5.2.2) ------------------------------------------------------------------------ [2008-12-23 19:13:06] joe at digg dot com This isn't bogus. At some point this was NOT valid, but now appears to be valid. In 5.2.6 it works fine, but in 5.2.0 it does NOT: jstump@devwww25:~$ php -v && php -q foo.php PHP 5.2.0-8+etch1 (cli) (built: Mar 8 2007 09:15:48) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies PHP Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 3 in /home/jstump/foo.php on line 5 Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 3 in /home/jstump/foo.php on line 5 ------------------------------------------------------------------------ [2008-12-23 19:07:31] felipe@php.net Says the PCRE documentation: "In PCRE, a subpattern can be named in one of three ways: (?<name>...) or (?'name'...) as in Perl, or (?P<name>...) as in Python." ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/46904 -- Edit this bug report at http://bugs.php.net/?id=46904&edit=1

« previous php.doc.bugs (#2769) next »