|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #62428 PCRE "\g" escape missing "<name>" in documentation
Submitted: 2012-06-27 01:31 UTC Modified: 2015-06-14 14:14 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: danielklein at airpost dot net Assigned: cmb (profile)
Status: Closed Package: PCRE related
PHP Version: 5.4.4 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: danielklein at airpost dot net
New email:
PHP Version: OS:


 [2012-06-27 01:31 UTC] danielklein at airpost dot net

PCRE also allows "\g" to use "<name>". I don't know since which version of PHP, but going by the existing documentation it should have been between 5.2.2 and 5.2.4. Please make note of this in the documentation.

Test script:
var_dump(preg_match('/(?<bar>o)\g<bar>/', 'foo'));

Actual result:


angle-brackets-and-apos (last revision 2015-04-27 16:09 UTC by
angle-brackets (last revision 2015-04-23 11:53 UTC by

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-15 14:15 UTC] ppaisndud at gmail dot com
Documentation has been fixed, can be closed
 [2015-04-23 03:34 UTC] danielklein at airpost dot net
I don't see any change. Where does it say \g<name> in the documentation?
 [2015-04-23 11:52 UTC]
-Package: Documentation problem +Package: PCRE related
 [2015-04-23 11:52 UTC]
Indeed, \g<name> is not documented yet. The feature is available
since 5.2.7.[1]

[1] <>
 [2015-04-23 11:53 UTC]
The following patch has been added/updated:

Patch Name: angle-brackets
Revision:   1429789995
 [2015-04-25 08:04 UTC] danielklein at airpost dot net
Thanks for the patch! I just checked \g'name' and that can be used too. I got the same results by checking the link you provided (PHP==4.4.9 and PHP>=5.2.7).
 [2015-04-27 16:08 UTC]
-Status: Open +Status: Verified
 [2015-04-27 16:08 UTC]
Thanks, Daniel, for pointing out \g'name'. For reference: <>.
 [2015-04-27 16:09 UTC]
The following patch has been added/updated:

Patch Name: angle-brackets-and-apos
Revision:   1430150948
 [2015-06-14 14:13 UTC]
Automatic comment from SVN on behalf of cmb
Log: documented \g&lt;name&gt; and \g'name' syntax for PCRE patterns (fixes bug #62428)
 [2015-06-14 14:14 UTC]
-Status: Verified +Status: Closed -Assigned To: +Assigned To: cmb
 [2015-06-14 14:14 UTC]
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.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 18 07:03:37 2021 UTC