Assuming it's about removing balanced parenthesis, I'd go for:
my $balance; # Notice declaring $balance beforehand is important, # otherwise you pick up the global inside (??{}) $balance=qr/(?:[^()]|\((??{$balance})\))*/; $string =~ s/\($balance\)//g;
In reply to Re^3: regular expression paranthesis remover
by thospel
in thread regular expression paranthesis remover
by Kanishka
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |