angieteh
asked on
greping data
given some text ...
From me Wed Jun 23 14:29:10 1999
X-Sender: me@mail.mynet
X-Mailer: Windows Eudora Pro Version 3.0 (32)
Date: Wed, 23 Jun 1999 14:30:32 +0800
To: me@mynet.net
From: me
Subject: multipart message test
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="================ =====_9300 90632==_"
How would be extract the boundry string and place it in $boundary.
thanks
From me Wed Jun 23 14:29:10 1999
X-Sender: me@mail.mynet
X-Mailer: Windows Eudora Pro Version 3.0 (32)
Date: Wed, 23 Jun 1999 14:30:32 +0800
To: me@mynet.net
From: me
Subject: multipart message test
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="================
How would be extract the boundry string and place it in $boundary.
thanks
ASKER
can you please explain what that does ?
ASKER
i'm sure it works ...
but can you please explain what it does ... and resubmit answer to get the points.
thanks
but can you please explain what it does ... and resubmit answer to get the points.
thanks
$line =~
/^Content\-Type: multipart\/mixed;boundary= "(.*)"$/;
$boundary = $1;
The first line looks for the line "Content... The "(.*)"$ says take everything after the first " until the " at the end of the line and store it in $1 (a reserved variable)
The next line stores $1 into the $boundary variable.
/^Content\-Type: multipart\/mixed;boundary=
$boundary = $1;
The first line looks for the line "Content... The "(.*)"$ says take everything after the first " until the " at the end of the line and store it in $1 (a reserved variable)
The next line stores $1 into the $boundary variable.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
'-' does not have a special meaning inside regexps
'/' only has a special meaning inside strings quoted with /
'/' only has a special meaning inside strings quoted with /
$line =~
/^Content\-Type: multipart\/mixed;boundary=
$boundary = $1;