|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-11-14 16:16 UTC] 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)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 17 02:00:01 2025 UTC |
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.