(?:[^{}]+?|\{(??{$parens})\})*
Such a regex with nested quantifiers is potentially dangerous, because the outer quantifier can force the inner quantifier to backtrack. Use a non-backtracking group (?>...)* instead. (Oh, and why are you using non-greed +? on the [^{}] group? I see no reason for that).
In reply to Re: balanced parens regexp hangs
by moritz
in thread balanced parens regexp hangs - solved
by grizzley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |