in reply to search for matching parentheses
I use this regex to match (but not capture) nested parens. It's from the Camel, 3rd. ed., p. 314.
my $np; $np = qr{ \( (?: (?> [^()]+ ) | (??{ $np }) )* \) }x;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: search for matching parentheses
by smammy (Novice) on Oct 20, 2006 at 16:14 UTC |