>>300
perlの正規表現のマニュアルの (??{ code }) のところにそのものずばりの例がある。

$re = qr{
\(
(?:
(?> [^()]+ )# Non-parens without backtracking
|
(??{ $re })# Group with matching parens
)*
\)
}x;

ttp://perldoc.perl.org/perlre.html