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
In reply to Re: Re: Regex To remove text between parentheses
by Hofmator
in thread Regex To remove text between parentheses
by beretboy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |