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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 06:01:29 2024 UTC