From: J�rgen Exner on
Peng Yu <pengyu.ut(a)gmail.com> wrote:
>The following webpage shows brace-matching for perl regex. But I don't
>find the matchpairs module. (I'm using perl 5.10.1). Would you please
>let me know if there is a way to match block of nested braces in perl?

You keep asking very basic questions and questions that are answered in
the FAQ. I _VERY_STRONGLY_ suggest you familiarize yourself with the
FAQ.

Here is the last fish for you: "perldoc -q nest":
"How do I find matching/nesting anything?"

jue
From: Tad McClellan on
Peng Yu <pengyu.ut(a)gmail.com> wrote:
> Suppose I have some C++ code like the following, I want to match the
> whole namespace x block.

[ snip string to match ]

> Would you please
> let me know if there is a way to match block of nested braces in perl?


Would you please scan the Perl FAQ before posting to the Perl newsgroup?

How do I find matching/nesting anything?

-------------------------
#!/usr/bin/perl
use warnings;
use strict;
use Regexp::Common;
;

$_ = '
namespace x
{
namespace y
{
....
}

}
';

if ( /(.*\n$RE{balanced}{-parens=>'{}'})/ ) {
print "$1\n\n";
}
-------------------------


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.