preg_match nested capture group order issue.

Phalanger Tools for Visual Studio [?] is complete PHP/Phalanger integration into Visual Studio development environment.

preg_match nested capture group order issue.

Postby niallb » March 10th, 2016, 1:44 pm

Hi,

When the inner of two nested numbered capture groups starts at the same location as the outer one Phalanger is getting the numbering wrong.

e.g.
Code: Select all
        preg_match('/((a)b)/', 'cab', $matches);
        print_r($matches);

With PHP outputs
Code: Select all
Array
(
    [0] => ab
    [1] => ab
    [2] => a
)

however, with Phalanger the output is
Code: Select all
Array
(
    [0] => ab
    [1] => a
    [2] => ab
)


(A work around is to insert a dummy non capturing group,
Code: Select all
 preg_match('/((?:)(a)b)/', 'cab', $matches);
)
niallb
 
Posts: 1
Joined: March 10th, 2016, 1:07 pm

Return to Phalanger Tools

Who is online

Users browsing this forum: No registered users and 1 guest

User Control Panel

Login

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 62 on January 7th, 2012, 10:54 pm

Users browsing this forum: No registered users and 1 guest
Phalanger