Hi,

PCRE (PERL) uses a backtracking mechanism, which is basically a depth-first 
search. Sometimes we need to record the current status, because we need to 
restore it if an alternative fails. These record/restore points are the nodes 
of the tree, and we travese the child nodes in a left-to-right order. Capturing 
brackets are such nodes.

Here is a simple example: (a)b|c
If 'a' matches, we need to set the start and end index of the capturing 
bracket. If 'b' does not match however, we need to restore the capturing 
bracket before 'c' is tried. (Ok there is much more behind the scenes, but I 
think it is enough to understand the basic concept)

So the 'recursion' term is somewhat general in this case.

Regards,
Zoltan

BF <[email protected]> írta:
>On Mon, 25 Apr 2011 12:06:41 +0400, Philip Hazel <[email protected]>  >
wrote:>
>
>>
> The explanation is not complete. I will add a sentence that says>
> something like "The match() function is also called in other>
> circumstances, for example, whenever a parenthesized sub-pattern is>
> entered and in certain cases of repetition.">
>>
>
Why a parenthesized sub-pattern produces recursion?>
Why each of a consequent parenthesized sub-patterns produces not  >
consequent but a deep recursion match() calls?>
>
PCRE version 8.11 2010-12-10>
/(a)(b)(c)/>
\Mabc>
Minimum match() limit = 5>
Minimum match() recursion limit = 4>
  0: abc>
  1: a>
  2: b>
  3: c>
>
Thanx.>
>
-- >
## List details at https://lists.exim.org/mailman/listinfo/pcre-dev >


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

Reply via email to