my $text = 'this {{}}should be {{test {{ab{{c}}d}} zzzz}}good {{bw}}'; my $nested = 100; my $re = '{{(?:[^{}]+|'; $re .= $re x ($nested); $re .= ')*}}' x ($nested + 1); $text =~ s/$re//sg; print "$text\n"; __END__|OUTPUT: this should be good
In reply to Re: Efficient way to match and replace nested braces (etc.)
by Anonymous Monk
in thread Efficient way to match and replace nested braces (etc.)
by dmn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |