On 2011-04-25 17:46, Herczeg Zoltán wrote:
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.


Thanx for explanation. Not at all is clear for me about the need of so deep recursion, but I will investigate this. I concerns about a significant stack expense in my Windows application. But want to keep the stack (no heap) memory usage.

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

Reply via email to