in reply to Re: Regex To remove text between parentheses
in thread Regex To remove text between parentheses
Or another version for this nested parens matching from the camel (3rd edition) which is a little bit easier to understand IMHO. But I'd guess that the recursion makes it slower
$re = qr{ \( (?: (?> [^()]+ ) # Non-parens without backtracking | (??{ $re }) # Group with matching parens )* \) }x; $text =~ s/$re//g;
-- Hofmator
|
|---|