preg_match nested capture group order issue.
1 post
• Page 1 of 1
preg_match nested capture group order issue.
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.
With PHP outputs
however, with Phalanger the output is
(A work around is to insert a dummy non capturing group,
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
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 7 guests