From: ivowel Date: 2009-01-24T10:03:08+09:00 Subject: Re: regex extension to handle matching parens? thank you, rob. great reference. now I know that it can be done. alas, this doc is a little over my head. can someone who has used this construct possibly please show me how I would try it on my simple example? sample = " \caption{my table \label{table-label} example: $\sqrt{2+ \sqrt{2}}$} more here {}" accomplishing this is actually not ugly at all in perl: use Regexp::Common; my $matchingarg = qr/$RE{balanced}{-parens=>'{ }'})/; /\\caption$matchingarg/; print "The \\caption argument is $1\n"; of course, perl is ugly in many other respects, but here, it does nicely. regards, /iaw