in reply to Re: Regexp for Match Brackets
in thread Regexp for Match Brackets
Oh, it's blazar. Simply put, to do it with regexes, you'd do something like:
It's not kid-tested, nor mother-approved, but it feels right, and that's where it counts. In the gut. Long live truthiness. Stephen Colbert++.my $paren_rx; $paren_rx = qr{ \( (?: (??{ $paren_rx }) # either match another paren-set | (?s: [^\\()]+ | \\. )+ # or match non-parens (or escaped parens +) )? \) }x; my ($chunk) = $string =~ /((??{$paren_rx}))/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Regexp for Match Brackets
by blazar (Canon) on May 05, 2006 at 14:02 UTC |