php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #42964 \G already supported
Submitted: 2007-10-14 22:11 UTC Modified: 2007-11-16 15:57 UTC
From: felipensp at gmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: Linux
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: felipensp at gmail dot com
New email:
PHP Version: OS:

 

 [2007-10-14 22:11 UTC] felipensp at gmail dot com
Description:
------------
"The Perl \G assertion is not supported as it is not relevant to single pattern matches." Said the documentation at http://br2.php.net/manual/en/reference.pcre.pattern.syntax.php

But, \G works in PCRE currently.

Reproduce code:
---------------
<?php

preg_match_all('/\Ga/', 'abaa', $matches);
print_r($matches);

preg_match_all('/\Ga/', 'aaba', $matches);
print_r($matches);

preg_match_all('/a/', 'abaa', $matches);
print_r($matches);

?>

Actual result:
--------------
Array
(
    [0] => Array
        (
            [0] => a
        )

)
Array
(
    [0] => Array
        (
            [0] => a
            [1] => a
        )

)
Array
(
    [0] => Array
        (
            [0] => a
            [1] => a
            [2] => a
        )

)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-16 15:57 UTC] felipensp at gmail dot com
The Perl \G works different with PCRE \G, it accepts multiples ERs using same position referenced by \G. The PCRE \G is documented in same page, and it's used in single pattern.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 17:01:33 2025 UTC