$_ = '1()()()2923()())))(('; s/[()]+//g; print;
Update: Misread the question and you want to remove using balanced parens: use Regexp::Common::balanced
update2 And there is the solution based on the balanced parens re in perlre i.e.
$string='111(22(33))44554'; $re = qr/\((?:(?>[^()+])|(??{$re}))*\)/; $string =~ s/$re//; print $string
-enlil
In reply to Re: regular expression paranthesis remover
by Enlil
in thread regular expression paranthesis remover
by Kanishka
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |