= $3; # check for years 19xx, 20xx or xx
Regards
Mark
- Original Message -
From: "Gary Luther" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 17, 2001 3:31 PM
Subject: Regex giving me fits!! :-(
I am having to parse dates out of lines w
> this should work, tho i haven't tried it:
>
> $look =~ m!DATE[ :]+(\d{2}/\d{2}\d{2,4})!;
should read:
$look =~ m!DATE[ :]+(\d{2}/\d{2}/\d{2,4})!;
^
that's what i get for not trying it!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-m
It's working here!!
Aziz,,,
#!/usr/bin/perl -w
for $look(){
$look =~ /^\s*DATE\s?\W?\s+(\d{2}\/\d{2}\/\d{2,4})/;
print ++$i . " $1\n";
}
__DATA__
DATE: 12/12/12
DATE 12/12/12
DATE : 12/12/12
DATE: 12/12/1212
In article <[EMAIL PROTECTED]>, "Gary Luther" <[EMAIL PROTECTED]>
wrote:
>
> EFFECTIVE DATE: 07/12/01DAILY CUSTOMER ACCOUNT REPORT
> RUN DATE: 07/13/01
> DATE: nn/nn/nn
> DATE nn/nn/nn
> DATE : nn/nn/nn
> DATE: nn/nn/
>
> $look =~ /^\s*DATE\s?\W?\s+(\d{2}\/\d{2}\/\d{2,4})/;
First off, if you have literal s
The ^ at the start indicates match from the start of a new line.
You don't need this. Try:-
$look =~ /\w{4}\:??\s+([\d\/]+)/;
Gary Luther wrote:
>
> I am having to parse dates out of lines where the date format varies considerably.
>
> Here is the statement that is contained in $look
>
> EF
I am having to parse dates out of lines where the date format varies considerably.
Here is the statement that is contained in $look
EFFECTIVE DATE: 07/12/01DAILY CUSTOMER ACCOUNT REPORT
RUN DATE: 07/13/01
There are two blanks (in this