Dr. Rudd: Thank you. That worked. I read up some docs on perlre. I know what .* 
does. But couldn't figure out what does .*? does. Can Someone explain what that 
? does
Also in the variant you suggested what does [^)] inside the paranthesis do?
Thanks
Ravi
----- Original Message ----
From: Dr.Ruud <[EMAIL PROTECTED]>
To: beginners@perl.org
Sent: Sunday, June 15, 2008 8:55:31 PM
Subject: Re: Including the carriage return in extraction

Ravi Malghan schreef:

> Hi: I want to extract data between the first parenthesis and the last
> in the below variable. I have tried a number of combinations. I
> either miss the entire string or get data only until the first
> carriage return. Can someone help me to extract the data including
> the carriage return between the parenthesis? $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;


Or use this variant:

  $OrigString =~ m/REQUEST\(([^)]*)\);/;

-- 
Affijn, Ruud

"Gewoon is een tijger."


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




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


Reply via email to