Maybe you're referring to nested parenthetics, which your regex indeed doesn't handle properly.
Can you elucidate?c:\@Work\Perl\monks>perl -wMstrict -le "my $desc = 'leave (only text) this () too -- does not (v(w(x)y)z) wor +k'; $desc =~ s/\(.*?\)//gs; print qq{'$desc'}; " 'leave this too -- does not y)z) work'
Update: If you're concerned about nested parens, maybe see Regexp::Common::balanced (used as below):
(Update update: Regexp::Common::balanced is 5.8 compatible.)c:\@Work\Perl\monks>perl -wMstrict -le "use Regexp::Common qw(balanced); ;; my $desc = 'a (text) b () c (v(w(x)y)z) d ((())) e (unbalanced(balanc +ed) f'; $desc =~ s{ $RE{balanced}{-parens => '()'} }{}xmsg; print qq{'$desc'}; " 'a b c d e (unbalanced f'
Give a man a fish: <%-{-{-{-<
In reply to Re: Strip brackets and contents from string
by AnomalousMonk
in thread Strip brackets and contents from string
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |