in reply to search for matching parentheses

I think this is from Tom Christiansen's Perl Cookbook, but it's not handy right now... so here goes:
my $np; $np = qr{ \( (?: (?> [^( )]+ ) # Non-capture group w/o backtracking | (??{ $np }) # Group with matching parens )* \) }x;
I think you could also look at the Text::Balanced module's extract_bracketed subroutine to see how it's done there.

Match time pattern interpolation makes Perl's regexes much more powerful than most regex engines... not quite the power of a grammar/parser but still quite powerful, given their compactness. Of course, this is just an intuition on my part... is there a proof (or counterexample) that shows that regexes cannot in general do what a more general parser can do?