On Sat, 12 Dec 2009, ND wrote:

> Hi, Philip!
> 
>   I use PCRE 8.0
> 
>   pattern: (?(DEFINE)(?<s>(i)))(?&s)
>   subject: pi
>   result: match, but no subpatterns captured
>   expected: 'i' returned as subpattern
> 
> Is this planned behavior?

Yes. And it is the same behaviour as Perl 5 (I have just tested). In the
section entitled SUBPATTERNS AS SUBROUTINES in the pcrepattern man page,
there is this paragraph (note the final sentence):

    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.

Philip

-- 
Philip Hazel

-- 
## List details at http://lists.exim.org/mailman/listinfo/pcre-dev 

Reply via email to