Re: regexp novice
| From: | shiplu | Date: | Fri, 18 May 2012 13:39:49 +0000 |
| Subject: | Re: regexp novice | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317895@lists.php.net to get a copy of this message | ||
On Fri, May 18, 2012 at 7:34 PM, Stuart Dallas <stuart@3ft9.com> wrote:
> Based on your requirements, 00:40 is completely valid. Why do you think it
> should be invalid?
00:40 is not a valid 12-hour format.
BTW I just found another non-regex approach. Its even faster.
function valid_time_Shiplu2($time) {
sscanf($time, "%2d%2d", $h, $m);
return ($h>0 && $h<13 && $m>=0 && $m<60);
}
--
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader