Bug #53309 [Opn->Bgs]: Capturing group failing with a colon
Edit report at http://bugs.php.net/bug.php?id=53309&edit=1
ID: 53309
Updated by: felipe@php.net
Reported by: michael at squiloople dot com
Summary: Capturing group failing with a colon
-Status: Open
+Status: Bogus
Type: Bug
Package: Regexps related
Operating System: Vista
PHP Version: 5.3.3
Block user comment: N
New Comment:
This is a behavior of PCRE library.
PCRE manpages says:
Like recursive subpatterns, a subroutine call is always treated
as an
atomic group. That is, once it has matched some of the subject
string,
it is never re-entered, even if it contains untried
alternatives and
there is a subsequent matching failure. Any capturing parentheses
that
are set during the subroutine call revert to their previous
values
afterwards.
Previous Comments:
------------------------------------------------------------------------
[2010-11-14 16:16:33] michael at squiloople dot com
Description:
------------
In some circumstances, when a colon is a specified character in a
capturing group,
it unexpectedly fails.
Test script:
---------------
preg_match('/^(([a-z])(?::(?2))*)::(?:(?1):)[a-z]$/', 'a::a:a');
preg_match('/^(([a-z])(?::(?2))*)::(?:(?1)-)[a-z]$/', 'a::a-a');
Expected result:
----------------
int(1)
int(1)
Actual result:
--------------
int(0)
int(1)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53309&edit=1
Thread (4 messages)