日期正则表达式

 日期正则表达式

^(?=/d)(?:(?!(?:1582(?:/.|-|//)10(?:/.|-|//)(?:0?[5-9]|1[0-4]))|(?:1752(?:/.|-|//)0?9(?:/.|-|//)(?:0?[3-9]|1[0-3])))(?=(?:(?!000[04]|(?:(?:1[^0-6]|[2468][^048]|[3579][^26])00))(?:(?:/d/d)(?:[02468][048]|[13579][26]))/D0?2/D29)|(?:/d{4}/D(?!(?:0?[2469]|11)/D31)(?!0?2(?:/.|-|//)(?:29|30))))(/d{4})([-//.])(0?/d|1[012])/2((?!00)[012]?/d|3[01])(?:$|(?=/x20/d)/x20))?((?:(?:0?[1-9]|1[012])(?::[0-5]/d){0,2}(?:/x20[aApP][mM]))|(?:[01]/d|2[0-3])(?::[0-5]/d){1,2})?$

 

Description: yyyy/mm/dd hh:MM:ss Datetime for all AD years, including leap years. Javascript safe version of http://regexlib.com/REDetails.aspx?regexp_id=760. Please see that regex for details of what is being checked
Matches: [0008-02-29], [2:34:59 PM], [9999/12/31 11:59 PM]  
Non-Matches: [04/04/04], [1:00], [1999/1/32]

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值