in reply to Efficient way to match and replace nested braces (etc.)
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Efficient way to match and replace nested braces (etc.)
by Anonymous Monk on Apr 13, 2012 at 07:42 UTC |