Dr.Ruud wrote:
Ravi Malghan schreef:
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?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

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


Reply via email to