Re: Q on Regular Expressions
| From: | Curt Zirzow | Date: | Wed, 17 Sep 2003 21:13:47 +0000 |
| Subject: | Re: Q on Regular Expressions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162927@lists.php.net to get a copy of this message | ||
* Thus wrote jsWalter (jsWalter@torres.ws):
> I have a fairly complicated regular expression that was written for perl.
>
> I've spent the last 4 days trying to convert it to PHP.
have you looked at strtotime()?
http://php.net/strtotime
The Date formats it can find are defined here:
http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html
Those regex's look like a nightmare, like they usually do :)
>
> # Does input match this RegEx?
>
> (($day,$mon,$yr,$hr,$min,$sec,$tz) =
> /^
> (\w{1,3}) # month
> \s+
> (\d\d?) # day
> \s+
> (\d\d?):(\d\d) # hour:min
> (?::(\d\d))? # optional seconds
> \s+
> (?:([A-Za-z]+)\s+)? # optional timezone
> (\d+) # year
> \s*$ # allow trailing whitespace
> /x)
>
Curt
--
"I used to think I was indecisive, but now I'm not so sure."