日期时间正则表达式
正则表达式 |
(?n:^(?=\d)((?<day>31(?!(.0?[2469]|11))|30(?!.0?2)|29(?(.0?2)(?=.{3,4}(1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[3579][26])00))|0?[1-9]|1\d|2[0-8])(?<sep>[/.-])(?<month>0?[1-9]|1[012])\2(?<year>(1[6-9]|[2-9]\d)\d{2})(?:(?=\x20\d)\x20|$))?(?<time>((0?[1-9]|1[012])(:[0-5]\d){0,2}(?i:\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$)
|
---|---|
匹配 |
31/12/2003
|29/2/2004 4:50 PM
|23:59:59
|
不匹配 |
12/31/2003
|29/2/2003
|4:00
|
29/02/1972
|5-9-98
|10-11-2002
|
---|
29/02/2003
|12/13/2002
|1-1-1500
|
Jan 1,2003
|February 29,2004
|November 02,3202
|
---|
Feb 29,2003
|Apr 31,1978
|jan 33,3333
|
12:15
|10:26:59
|22:01:15
|
---|
24:10:25
|13:2:60
|
11/24/0004 11:59 PM
|2.29.2008
|02:50:10
|
---|
12/33/1020
|2/29/2005
|13:00 AM
|
10/03/1979
|1-1-02
|01.1.2003
|
---|
10/03/197
|09--02--2004
|01 02 03
|
1/2/03
|02/30/1999
|3/04/00
|
---|
3/4/2020
|3/4/1919
|4/31/2000
|
20000101|20051231|20040229 |
---|
19990101|20053112|20050229 |
08:00AM|10:00am|7:00pm |
---|
13:00pm|12:65am |
01/01/2001|1/1/1999|10/20/2080 |
---|
13/01/2001|1/1/1800|10/32/2080 |
4/1/2001|12/12/2001|55/5/3434 |
---|
1/1/01|12 Jan 01|1-1-2001 |
00-00-00 00:00:00|0000-00-00 00:00:00|09-05-22 08:16:00|1970-00-00 00:00:00|20090522081600 |
---|
2009-13:01 00:00:00|2009-12-32 00:00:00|2002-12-31 24:00:00|2002-12-31 23:60:00|02-12-31 23:00:60 |
04/04/04|1:00|1999/1/32 |
---|
00:00|23:59|10:10 |
---|
24:00|00:60|25:61 |
2004-04-30|2004-02-29 |
---|
2004-04-31|2004-02-30 |
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。