in reply to Re: Efficient way to match and replace nested braces (etc.)in thread Efficient way to match and replace nested braces (etc.)
my $re = '{{(?:[^{}]+|'; $re .= $re x ($nested) . "\b" . ')*}}' x ($nested + 1); [download]