in reply to Re: Regexp for Match Brackets
in thread Regexp for Match Brackets

WHO HAS WAKED ME FROM MY SLUMBER?

Oh, it's blazar. Simply put, to do it with regexes, you'd do something like:

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}))/;
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++.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^3: Regexp for Match Brackets
by blazar (Canon) on May 05, 2006 at 14:02 UTC

    Yes, but I seem to remember an article, perhaps downloadable in .pdf form that explained "this kinda things" in detail and from step to step. The OP could be interested in it...