php.net |  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
Votes:1
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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: danielklein at airpost dot net
New email:
PHP Version: OS:

 

 [2012-06-27 01:31 UTC] danielklein at airpost dot net
Description:
------------
http://www.php.net/manual/en/regexp.reference.back-references.php

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:
---------------
<?php
var_dump(preg_match('/(?<bar>o)\g<bar>/', 'foo'));
?>

Actual result:
--------------
int(1)

Patches

angle-brackets-and-apos (last revision 2015-04-27 16:09 UTC by cmb@php.net)
angle-brackets (last revision 2015-04-23 11:53 UTC by cmb@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

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] cmb@php.net
-Package: Documentation problem +Package: PCRE related
 [2015-04-23 11:52 UTC] cmb@php.net
Indeed, \g<name> is not documented yet. The feature is available
since 5.2.7.[1]

[1] <http://3v4l.org/tfeSh>
 [2015-04-23 11:53 UTC] cmb@php.net
The following patch has been added/updated:

Patch Name: angle-brackets
Revision:   1429789995
URL:        https://bugs.php.net/patch-display.php?bug=62428&patch=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] cmb@php.net
-Status: Open +Status: Verified
 [2015-04-27 16:08 UTC] cmb@php.net
Thanks, Daniel, for pointing out \g'name'. For reference: <http://3v4l.org/qsZAQ>.
 [2015-04-27 16:09 UTC] cmb@php.net
The following patch has been added/updated:

Patch Name: angle-brackets-and-apos
Revision:   1430150948
URL:        https://bugs.php.net/patch-display.php?bug=62428&patch=angle-brackets-and-apos&revision=1430150948
 [2015-06-14 14:13 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=336943
Log: documented \g&lt;name&gt; and \g'name' syntax for PCRE patterns (fixes bug #62428)
 [2015-06-14 14:14 UTC] cmb@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: cmb
 [2015-06-14 14:14 UTC] cmb@php.net
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-2020 The PHP Group
All rights reserved.
Last updated: Fri Oct 30 08:01:25 2020 UTC