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: word but not only
> > that
> > line. I mean to say that I need only this string Thu, 23 May 2002 19:47:50
> > +0530  . Can someone help me in this. I am trying
> >  $header =~ m/Date:/; and then my $ab =  " $' \n"; but this gives me
> > everything after Date: word. As I wrote above, I need only Thu, 23 May
> > 2002
> > 19:47:50 +0530   string
> 
> we did a similar problem trying to grovel out the Proxy-Auth:
> 
> http://www.wetware.com/drieux/pbl/RegEx/parseProxyAuth.txt
> 
> the simplest solution would be
> 
>         $header =~ m/Date:\s*([^\n]+)/;
                                ^^^^^^
[^\n]+ is the same as .+ because the period (.) does not match a newline
unless you are using the /s modifier.


>                 my $dtg = $1;

You should test that the regular expression matched successfully before
using the numeric scalar variables.



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to