#50306 [Opn->Csd]: preg_match_all() example #3 is wrong

From: Date: Thu, 17 Dec 2009 12:30:03 +0000
Subject: #50306 [Opn->Csd]: preg_match_all() example #3 is wrong
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3501@lists.php.net to get a copy of this message
ID: 50306 Updated by: seld@php.net Reported By: kalle dot v at kolumbus dot fi -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Red Hat PHP Version: Irrelevant -Assigned To: +Assigned To: seld 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-12-17 12:28:27] svn@php.net Automatic comment from SVN on behalf of seld Revision: http://svn.php.net/viewvc/?view=revision&revision=292248 Log: Emphasize the use of ?P<> for named sub-patterns instead of the backwards incompatible ?<>. Fixes bug #50306 - refs bug #46904 ------------------------------------------------------------------------ [2009-11-26 06:55:57] kalle dot v at kolumbus dot fi Description: ------------ Similar to Bug #46904 preg_match() example #4 is wrong (http://bugs.php.net/bug.php?id=46904), but with preg_match_all. Seems the original issue discussed in the comments of bug #46904 is not actually related only to PHP version. I have a Red Hat box with PHP 5.2.6 installed but still this doesn't work: (?<name>\w+) and this works: (?P<name>\w+) And I had some trouble figuring this one out, since I use preg_match_all and in the preg_match_all documentation example #3 is similar to the one that was previously in preg_match example #4. And named subpatterns was something I hadn't used before, so I didn't know about the different syntaxes. So I think at least the same comment that was added to preg_match should be added to preg_match_all documentation so people will know there are these different syntaxes and they can try them out if they get errors. But maybe someone should check this again to find out what actually makes these different syntaxes work with different PHP versions/machines/operating systems. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50306&edit=1

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