Re: [pcre-dev] Atomic group optimizations issue

Top Page
Delete this message
Author: Zoltán Herczeg
Date:  
To: ND
CC: Pcre-dev@exim.org
Subject: Re: [pcre-dev] Atomic group optimizations issue
Hi,

>Can you explain, why capturing atomic groups with capturing brackets
>inside can't produce tail recursion in cases when '(?:' can do this?


because PCRE has to prepare for the worst case scenario. Your input string does not match to the capturing bracket, so the capturing bracket does not increase the backtracking depth (it could if the input would be different). However, pcre_compile does not know anything about the input. The compiled pattern must work even if the capturing bracket matches sometimes, so the engine must choose the costly OP_ONCE instead of OP_ONCE_NC.

Regards,
Zoltan