in reply to Regex to parse a date
If you want to take care:$_="2003 % 05 % 1720:55:23"; s/\D+//g; ($y, $m, $d, $H, $M, $S)=unpack("a4a2a2a2a2a2", $_);
$_="2003 % 05 % 1720:55:23"; warn "wrong Date" unless ($y, $m, $d, $H, $M, $S)=~ /(\d{4})\s+%\s+([01]\d)\s+%\s+([0-3] +\d)([0-2]\d):([0-5]\d):([0-5]\d)/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regex to parse a date
by MD (Initiate) on May 19, 2003 at 10:14 UTC |