Aug
06
2019
小时:分钟的正则表达式
小时:分钟的正则表达式检查,下面以php为例,验证值必须满足 01:23 这种格式的。
/**
* 小时:分钟的正则表达式检查
*
* @param string $value 要检查的字符串
* @return boolean 返回检查结果
*/
function isUrl($value) {
$regEx = " ^([0-1]{1}\d|2[0-3]):([0-5]\d)$";
return !$value ? false : preg_match($regEx, $value);
}
微信扫一扫,打赏作者吧~