Gunnar Hjalmarsson schreef: > Dr.Ruud: >> Ravi Malghan: >>> I want to extract data between the first parenthesis and the last >>> in the below variable. > > <snip> > >>> $OrigString = >>> "REQUEST(SERVICE,1DJGHKDFJGHDFJGHKDFJH\nDFJHGDFJHGJDFHGJKDFHG\nHGJDFHGJK >>> DFHGJKDFHGJKDFH);"; >>> $OrigString =~ m/REQUEST\((.*)\);/; >>> print "$1\n"; >> >> Read perlre, about the s-modifier. I also added non-greediness. >> >> $OrigString =~ m/REQUEST\((.*?)\);/s; > > Since the OP wants to extract everything up to the _last_ parenthesis, > non-greediness is not really applicable, is it?
That is exactly why I explicitely mentioned it. If the data can contain a (closing!) parenthesis, adjust. Was my "Or use this variant" really not clear enough for you? I don't believe so. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/