On Thu, 05 May 2005 13:54:22 +0530, Baskaran wrote:
> How to select the content of the groups suppose the string
> 
> \newcommand{\sumfun}{\sum_{i=1,2,\ldots}^{n}f(x)}
> 
> if i use the command
> 
> s/\\newcommand\{(.*?)\}\{(.*?)\}//g;
> 
> I get the value 2nd group is "\sum_{i=1,2,\ldots" But my expected output is
> \sum_{i=1,2,\ldots}^{n}f(x)
> (i.e. i want to select the content of matching braces)
> if i use (.*) it goes to the last brace in the end of file.
> Kindly suggest me an idea

http://search.cpan.org/~abigail/Regexp-Common-2.120/lib/Regexp/Common/balanced.pm
Or 
http://search.cpan.org/~jhi/perl-5.8.1/lib/Text/Balanced.pm

which is in later Perl cores.

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to