Re: regexp novice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 18, 2012 at 7:34 PM, Stuart Dallas <stuart@xxxxxxxx> 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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux