Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 24小时时间的Reg ex 24只允许4位数字_Regex - Fatal编程技术网

Regex 24小时时间的Reg ex 24只允许4位数字

Regex 24小时时间的Reg ex 24只允许4位数字,regex,Regex,我需要在24小时内使用regexp,并且只有4位数字是有效的。ex0730有效,730无效 我试过[01]?[0-9]| 2[0-3][0-5][0-9] 但这不是我想要的。有人看到什么不对劲吗?删除问号: ([01]?[0-9]|2[0-3])[0-5][0-9] ^ This one 那个?表示上一个匹配是可选的。删除它使其成为强制性的

我需要在24小时内使用regexp,并且只有4位数字是有效的。ex0730有效,730无效

我试过[01]?[0-9]| 2[0-3][0-5][0-9]


但这不是我想要的。有人看到什么不对劲吗?

删除问号:

([01]?[0-9]|2[0-3])[0-5][0-9] ^ This one 那个?表示上一个匹配是可选的。删除它使其成为强制性的