Drieux wrote:
>
> On Friday, May 24, 2002, at 08:13 , Ankit Gupta wrote:
>
> > I am working on a project in which I need to get Date part of
> > below written header. I am trying to use Regular expression to extract
> > Date:
> > line. I am able to achieve everything after the Date: wo
> > ...
> > Date: Thu, 23 May 2002 19:47:50 +0530
> > ...
>
> $header = $1 if /^Date: (.*)/;
> This should do what you want.
Two things:
1) should anchor this regex to the end of the line to make sure you get
the entire line in $1
2) should use the //m switch to treat your string as multiple
On Friday, May 24, 2002, at 08:13 , Ankit Gupta wrote:
> Hello,
>
> I am working on a project in which I need to get Date part of
> below written header. I am trying to use Regular expression to extract
> Date:
> line. I am able to achieve everything after the Date: word but not only
Ankit Gupta wrote at Fri, 24 May 2002 17:13:52 +0200:
> Hello,
>
> I am working on a project in which I need to get Date part of
> below written header. I am trying to use Regular expression to extract Date: line. I
>am able to
> achieve everything after the Date: word but not only th
Here is a shot:
#
# Loading header with the data provided
#
my $header = <<'HEADER';
To: "Ankit Gupta" <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
<001c01c200e0$9a1d9720$7d82c8cb@ashokgup>
<[EMAIL PROTECTED]>
Subject: Re:
Date: Thu, 23 May 2002 19:47:50 +0530
MIME-Version: 1.0
Con
Title: RE: Need help in Regular Expression
Ankit:
$header = $1 if /^Date: (.*)/;
This should do what you want.
Regards,
Ian Samuel
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 24, 2002 10:14 AM
To: [EMAIL PROTECTED]
Subject: Need help