标签:oct mon time 正则 sep apr style cin 日期时间
正则表达式 |
(?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
|
正则表达式 |
^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?: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])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$
|
---|---|
匹配 |
29/02/1972 | 5-9-98 | 10-11-2002
|
不匹配 |
29/02/2003 | 12/13/2002 | 1-1-1500
|
正则表达式 |
^(?:(((Jan(uary)?|Ma(r(ch)?|y)|Jul(y)?|Aug(ust)?|Oct(ober)?|Dec(ember)?)\ 31)|((Jan(uary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sept|Nov|Dec)(ember)?)\ (0?[1-9]|([12]\d)|30))|(Feb(ruary)?\ (0?[1-9]|1\d|2[0-8]|(29(?=,\ ((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))))\,\ ((1[6-9]|[2-9]\d)\d{2}))
|
---|---|
匹配 |
Jan 1, 2003 | February 29, 2004 | November 02, 3202
|
不匹配 |
Feb 29, 2003 | Apr 31, 1978 | jan 33,3333
|
正则表达式 |
^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$
|
---|---|
匹配 |
12:15 | 10:26:59 | 22:01:15
|
不匹配 |
24:10:25 | 13:2:60
|
正则表达式 |
(?=\d)^(?:(?!(?:10\D(?:0?[5-9]|1[0-4])\D(?:1582))|(?:0?9\D(?:0?[3-9]|1[0-3])\D(?:1752)))((?:0?[13578]|1[02])|(?:0?[469]|11)(?!\/31)(?!-31)(?!\.31)|(?:0?2(?=.?(?:(?:29.(?!000[04]|(?:(?:1[^0-6]|[2468][^048]|[3579][^26])00))(?:(?:(?:\d\d)(?:[02468][048]|[13579][26])(?!\x20BC))|(?:00(?:42|3[0369]|2[147]|1[258]|09)\x20BC))))))|(?:0?2(?=.(?:(?:\d\D)|(?:[01]\d)|(?:2[0-8])))))([-.\/])(0?[1-9]|[12]\d|3[01])\2(?!0000)((?=(?:00(?:4[0-5]|[0-3]?\d)\x20BC)|(?:\d{4}(?!\x20BC)))\d{4}(?:\x20BC)?)(?:$|(?=\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})?$
|
---|---|
匹配 |
11/24/0004 11:59 PM | 2.29.2008 | 02:50:10
|
不匹配 |
12/33/1020 | 2/29/2005 | 13:00 AM
|
正则表达式 |
^([0]?[1-9]|[1|2][0-9]|[3][0|1])[./-]([0]?[1-9]|[1][0-2])[./-]([0-9]{4}|[0-9]{2})$
|
---|---|
匹配 |
10/03/1979 | 1-1-02 | 01.1.2003
|
不匹配 |
10/03/197 | 09--02--2004 | 01 02 03
|
正则表达式 |
^((0?[13578]|10|12)(-|\/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[01]?))(-|\/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1}))|(0?[2469]|11)(-|\/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[0]?))(-|\/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1})))$
|
---|---|
匹配 |
1/2/03 | 02/30/1999 | 3/04/00
|
不匹配 |
3/4/2020 | 3/4/1919 | 4/31/2000
|
正则表达式 |
^([2-9]\d{3}((0[1-9]|1[012])(0[1-9]|1\d|2[0-8])|(0[13456789]|1[012])(29|30)|(0[13578]|1[02])31)|(([2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00))0229)$
|
---|---|
匹配 | 20000101 | 20051231 | 20040229 |
不匹配 | 19990101 | 20053112 | 20050229 |
正则表达式 |
^([1-9]|1[0-2]|0[1-9]){1}(:[0-5][0-9][aApP][mM]){1}$
|
---|---|
匹配 | 08:00AM | 10:00am | 7:00pm |
不匹配 | 13:00pm | 12:65am |
正则表达式 |
^(([1-9])|(0[1-9])|(1[0-2]))\/(([0-9])|([0-2][0-9])|(3[0-1]))\/(([0-9][0-9])|([1-2][0,9][0-9][0-9]))$
|
---|---|
匹配 | 01/01/2001 | 1/1/1999 | 10/20/2080 |
不匹配 | 13/01/2001 | 1/1/1800 | 10/32/2080 |
正则表达式 |
^\d{1,2}\/\d{1,2}\/\d{4}$
|
---|---|
匹配 | 4/1/2001 | 12/12/2001 | 55/5/3434 |
不匹配 | 1/1/01 | 12 Jan 01 | 1-1-2001 |
正则表达式 |
(\d{2}|\d{4})(?:\-)?([0]{1}\d{1}|[1]{1}[0-2]{1})(?:\-)?([0-2]{1}\d{1}|[3]{1}[0-1]{1})(?:\s)?([0-1]{1}\d{1}|[2]{1}[0-3]{1})(?::)?([0-5]{1}\d{1})(?::)?([0-5]{1}\d{1})
|
---|---|
匹配 | 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 |
正则表达式 |
^(?=\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})?$
|
---|---|
匹配 | 0008-02-29 | 2:34:59 PM | 9999/12/31 11:59 PM |
不匹配 | 04/04/04 | 1:00 | 1999/1/32 |
正则表达式 |
^(([1-9]{1})|([0-1][0-9])|([1-2][0-3])):([0-5][0-9])$
|
---|---|
匹配 | 00:00 | 23:59 | 10:10 |
不匹配 | 24:00 | 00:60 | 25:61 |
正则表达式 |
^[0-9]{4}-(((0[13578]|(10|12))-(0[1-9]|[1-2][0-9]|3[0-1]))|(02-(0[1-9]|[1-2][0-9]))|((0[469]|11)-(0[1-9]|[1-2][0-9]|30)))$
|
---|---|
匹配 | 2004-04-30 | 2004-02-29 |
不匹配 | 2004-04-31 | 2004-02-30 |
标签:oct mon time 正则 sep apr style cin 日期时间
原文地址:http://www.cnblogs.com/doseoer/p/6255784.html