Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memory perentheses

Status
Not open for further replies.

Buddyholly83

IS-IT--Management
Aug 7, 2005
23
GB
I am parsing a string that looks like:
Code:
HTTP/1.1 200 OK
Cache-Control: private
Date: Fri, 12 Aug 2005 08:48:38 GMT
Server: Microsoft-IIS/6.0
Content-Length: 333
Content-Type: text/plain; charset=utf-8
Client-Date: Fri, 12 Aug 2005 08:48:36 GMT
Client-Peer: 217.158.183.37:80
Client-Response-Num: 1
Set-Cookie: ASP.NET_SessionId=fhpmis45n0h4zfbtb2nwkkml; path=/
X-AspNet-Version: 1.1.4322
X-Powered-By: ASP.NET

Body=Test+test+test&ReceivedAt=2005-08-11+15%3a10%3a48Z&Type=Text

I need to pattern match and extract the code of Body, ReceivedAt and Type using memory parentheses. I need $1 $2 and $3. Iam not having much success with this:

Code:
$string =~ m/[A-Za-z]{1,}=([A-Za-z0-9-%]){1,}&{0,1}/;

and even if this matched, it would only give me one value, $1 - I need $1 $2 and $3.

Thanks in advance :)
 
Code:
perl -lne 'print "[$1][$2][$3]\n" if /^Body=([^&]+)&ReceivedAt=([^&]+)&Type=(.*)$/;'





(very injured) Trojan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top