134 regular expressions found in this category!
Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
^((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})))$ |
Description |
improved date validation M/D/YY or M/D/YYYY or MM/DD/YYYY or MM/DD/YY: 1/1/1920 through 12/31/2019; Feb 29 and 30 always allowed, deal with it |
Matches |
1/2/03 | 02/30/1999 | 3/04/00 |
Non-Matches |
3/4/2020 | 3/4/1919 | 4/31/2000 |
Author |
Rating:
Brad Williams
|
Title |
Test
Details
Pattern Title
|
Expression |
(?=\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})?$ |
Description |
mm/dd/yyyy hh:MM:ss Datetime for all AD years, including leap years.
Javascript safe version of http://regexlib.com/REDetails.aspx?regexp_id=644. Please see that regex for details of what is being checked |
Matches |
11/24/0004 11:59 PM | 2.29.2008 | 02:50:10 |
Non-Matches |
12/33/1020 | 2/29/2005 | 13:00 AM |
Author |
Rating:
Michael Ash
|
Title |
Test
Details
Pattern Title
|
Expression |
^((\d{2}((0[13578]|1[02])(0[1-9]|[12]\d|3[01])|(0[13456789]|1[012])(0[1-9]|[12]\d|30)|02(0[1-9]|1\d|2[0-8])))|([02468][048]|[13579][26])0229)$ |
Description |
Date expression validator with format YYMMDD
Validates leap years.
Of course, as year has only 2 digits, it's not possible to invalidate years like 2100, 2200, 2300, etc as a non-leap years ! |
Matches |
751231 | 000229 | 040229 |
Non-Matches |
750431 | 010229 | 050229 |
Author |
Rating:
Dany Lauener
|
Title |
Test
Details
Date With Slashes
|
Expression |
^\d{1,2}\/\d{1,2}\/\d{4}$ |
Description |
This regular expressions matches dates of the form XX/XX/YYYY where XX can be 1 or 2 digits long and YYYY is always 4 digits long. |
Matches |
4/1/2001 | 12/12/2001 | 55/5/3434 |
Non-Matches |
1/1/01 | 12 Jan 01 | 1-1-2001 |
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^(20|21|22|23|[0-1]\d)[0-5]\d$ |
Description |
This regular expression will match a 24 hour time with no separators. |
Matches |
1200 | 1645 | 2359 |
Non-Matches |
2400 | asbc | 12:45 |
Author |
Rating:
Steven Smith
|
Title |
Test
Details
yyyy/mm/dd hhMMss Date
|
Expression |
^(?ni:(?=\d)((?'year'((1[6-9])|([2-9]\d))\d\d)(?'sep'[/.-])(?'month'0?[1-9]|1[012])\2(?'day'((?<!(\2((0?[2469])|11)\2))31)|(?<!\2(0?2)\2)(29|30)|((?<=((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[3579][26])00)\2\3\2)29)|((0?[1-9])|(1\d)|(2[0-8])))(?:(?=\x20\d)\x20|$))?((?<time>((0?[1-9]|1[012])(:[0-5]\d){0,2}(\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2}))?)$ |
Description |
YYYY/MM/DD hh:mm:ss format DateTime Regex.
This regex will validate a date, time or a datetime.
It will also capture the date fields and the time.
Dates are in the YYYY/MM/DD format and validated for months, number of days in a month and leap years (29/2)
Date field can be separated by matched periods(.), dashes(-) or forward slashes(/)
Time is either 12 hour AM/PM format (hh:mm:ss AM), where minutes and seconds are optional.
AM or PM required. or 24 hour military format (hh:mm:ss), from 00:00:00 to 23:59:59,
where hours and minutes fields are required, including leading 0 for hours less than 10.
Please refer to http://blogs.regexadvice.com/mash/archive/2004/04/23/1021.aspx for additional info
Datetime is the above date and time formats separated by a space,
with the date first (YYYY/MM/DD hh:mm:ss)
!IMPORTANT NOTE: your regex engine must support lookbehinds and named groups to use this expression |
Matches |
12:30 PM | 2004-02-29 | 2004/3/31 02:31:35 AM |
Non-Matches |
2:00 | 2200.2.29 | 0000/00/00 00:00:00 AM |
Author |
Rating:
Michael Ash
|
Title |
Test
Details
Pattern Title
|
Expression |
^(((((0[13578])|([13578])|(1[02]))[\-\/\s]?((0[1-9])|([1-9])|([1-2][0-9])|(3[01])))|((([469])|(11))[\-\/\s]?((0[1-9])|([1-9])|([1-2][0-9])|(30)))|((02|2)[\-\/\s]?((0[1-9])|([1-9])|([1-2][0-9]))))[\-\/\s]?\d{4})(\s(((0[1-9])|([1-9])|(1[0-2]))\:([0-5][0-9])((\s)|(\:([0-5][0-9])\s))([AM|PM|am|pm]{2,2})))?$ |
Description |
Following expression can be used to validate a datetime column from SQL Server. This expression is an enhanced version of Scott Watermasysk's date/time submission. It now accepts leading zeros in months, days, and hours. In addition, this expression properly handles the 11th hour. Watermasysk's would take the 10th and 12th hour but not the 11th. This regex has been tweaked to do so. Does not handle the February 29th problem on non-leap years yet. Will learn a little more about RegEx and do so in later submission.
|
Matches |
11/30/2003 10:12:24 am | 2/29/2003 08:14:56 pm | 5/22/2003 |
Non-Matches |
11/31/2003 10:12:24 am | 2/30/2003 08:14:56 pm | 5/22/2003 14:15 |
Author |
Rating:
David Darling
|
Title |
Test
Details
Pattern Title
|
Expression |
^(\d{2}((0[1-9]|1[012])(0[1-9]|1\d|2[0-8])|(0[13456789]|1[012])(29|30)|(0[13578]|1[02])31)|([02468][048]|[13579][26])0229)$ |
Description |
yyMMdd with leap years.
Minimized expression.
As we have only 2 numbers for the years, dates 1600, 2000, etc are still validated. |
Matches |
001231 | 000229 | 040229 |
Non-Matches |
003112 | 000431 | 010229 |
Author |
Rating:
Dany Lauener
|
Title |
Test
Details
Pattern Title
|
Expression |
^([0-9]{2})(00[1-9]|0[1-9][0-9]|[1-2][0-9][0-9]|3[0-5][0-9]|36[0-6])$ |
Description |
Matches a Julian date in the format YYDDD. Two digit year followed by a number from 1 - 366 indicating the day of the year. |
Matches |
99366 | 00001 |
Non-Matches |
74000 | 04367 |
Author |
Rating:
Brian James
|
Title |
Test
Details
Pattern Title
|
Expression |
^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$ |
Description |
Time in 24 hours format with optional seconds |
Matches |
12:15 | 10:26:59 | 22:01:15 |
Non-Matches |
24:10:25 | 13:2:60 |
Author |
Rating:
Carlos R. L. Rodrigues
|
Title |
Test
Details
Pattern Title
|
Expression |
^((((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00)))|(((0[1-9]|[12]\d|3[01])(0[13578]|1[02])((1[6-9]|[2-9]\d)?\d{2}))|((0[1-9]|[12]\d|30)(0[13456789]|1[012])((1[6-9]|[2-9]\d)?\d{2}))|((0[1-9]|1\d|2[0-8])02((1[6-9]|[2-9]\d)?\d{2}))|(2902((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00))))$ |
Description |
Date with leap years. Accepts '.' '-' and '/' as separators
d.m.yy to dd.mm.yyyy (or d.mm.yy, etc)
Ex: dd-mm-yyyy d.mm/yy dd/m.yyyy etc etc
Accept 00 years also. |
Matches |
29.2.2004 | 31121975 | 29/2-00 |
Non-Matches |
29.2.2005 | 32121975 | 29.2/01 |
Author |
Rating:
Dany Lauener
|
Title |
Test
Details
Pattern Title
|
Expression |
^[0,1]?\d{1}\/(([0-2]?\d{1})|([3][0,1]{1}))\/(([1]{1}[9]{1}[9]{1}\d{1})|([2-9]{1}\d{3}))$ |
Description |
This expression checks the validity of a date (US, but it is easily editable for other format's). Year's 1990-9999, Month's 1 or 01 to 12, Day's 1 or 01 to 31. Still needs to have individual months added (i.e., Feb's 28 days), and some how to check for leap year...the months issue should not be to hard, but the leap year seems like a real chore. Please let me know if you have any suggestions for leap year.
|
Matches |
01/01/1990 | 12/12/9999 | 3/28/2001 |
Non-Matches |
3-8-01 | 13/32/1001 | 03/32/1989 |
Author |
Rating:
Scott Watermasysk
|
Title |
Test
Details
Pattern Title
|
Expression |
^([0]?[1-9]|[1|2][0-9]|[3][0|1])[./-]([0]?[1-9]|[1][0-2])[./-]([0-9]{4}|[0-9]{2})$ |
Description |
Validate brazilian date formats: dd/mm/yyyy or d/m/yy or d.m.yyyy
with separators: . - /
Valid dates only! d (1-31)/ m (1-12)/ y (0..)
(rizzipereira.com.br)
For American date format: http://www.regexlib.com/REDetails.aspx?regexp_id=932 |
Matches |
10/03/1979 | 1-1-02 | 01.1.2003 |
Non-Matches |
10/03/197 | 09--02--2004 | 01 02 03 |
Author |
Rating:
Diego dos Santos
|
Title |
Test
Details
Pattern Title
|
Expression |
^((((0[13578])|(1[02]))[\/]?(([0-2][0-9])|(3[01])))|(((0[469])|(11))[\/]?(([0-2][0-9])|(30)))|(02[\/]?[0-2][0-9]))[\/]?\d{4}$ |
Description |
Date expressions that matches MM/DD/YYYY where MM and DD must be two digits and zero padded. Validates correctly for all months except February, which it assumes to always have 29 days. The "/" separator is optional. |
Matches |
01/01/2001 | 02/29/2002 | 12/31/2002 |
Non-Matches |
1/1/02 | 02/30/2002 | 1/25/2002 |
Author |
Rating:
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
(((0[1-9]|[12][0-9]|3[01])([/])(0[13578]|10|12)([/])(\d{4}))|(([0][1-9]|[12][0-9]|30)([/])(0[469]|11)([/])(\d{4}))|((0[1-9]|1[0-9]|2[0-8])([/])(02)([/])(\d{4}))|((29)(\.|-|\/)(02)([/])([02468][048]00))|((29)([/])(02)([/])([13579][26]00))|((29)([/])(02)([/])([0-9][0-9][0][48]))|((29)([/])(02)([/])([0-9][0-9][2468][048]))|((29)([/])(02)([/])([0-9][0-9][13579][26]))) |
Description |
Date in DD/MM/YYYY format.
Fecha en formato DD/MM/AAAA. |
Matches |
28/12/2003 | 28/02/2003 | 29/02/2000 |
Non-Matches |
28-02-2003 | 30/02/2003 | 28.02.2003 |
Author |
Rating:
Mathews Inga
|
Title |
Test
Details
Pattern Title
|
Expression |
^(?=\d)(?:(?!(?:(?:0?[5-9]|1[0-4])(?:\.|-|\/)10(?:\.|-|\/)(?:1582))|(?:(?:0?[3-9]|1[0-3])(?:\.|-|\/)0?9(?:\.|-|\/)(?:1752)))(31(?!(?:\.|-|\/)(?:0?[2469]|11))|30(?!(?:\.|-|\/)0?2)|(?:29(?:(?!(?:\.|-|\/)0?2(?:\.|-|\/))|(?=\D0?2\D(?:(?!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))))))|2[0-8]|1\d|0?[1-9])([-.\/])(1[012]|(?:0?[1-9]))\2((?=(?:00(?:4[0-5]|[0-3]?\d)\x20BC)|(?:\d{4}(?:$|(?=\x20\d)\x20)))\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})?$ |
Description |
dd/mm/yyyy hh:MM:ss Datetime for all AD years, including leap years.
Javascript safe version of http://regexlib.com/REDetails.aspx?regexp_id=691. Please see that regex for details of what is being checked |
Matches |
31.12.6008 | 5:30 AM | 30-04-1066 |
Non-Matches |
00/00/0000 | 99:99:99 | 29/02/2005 |
Author |
Rating:
Michael Ash
|
Title |
Test
Details
Pattern Title
|
Expression |
(([0-1][0-9])|([2][0-3])):([0-5][0-9]):([0-5][0-9]) |
Description |
Validates time in MySQL time format. 24 hour time colon seperated hours:minutes:seconds |
Matches |
09:30:00 | 17:45:20 | 23:59:59 |
Non-Matches |
24:00:00 |
Author |
Rating:
Patrick O'Hara
|
Title |
Test
Details
Pattern Title
|
Expression |
^[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)))$ |
Description |
Matches the date format "YYYY-mm-dd" and also validates month and number of days in a month. All leap year dates "YYYY-02-29" passes trough. Could easily be changed to another format. |
Matches |
2004-04-30 | 2004-02-29 |
Non-Matches |
2004-04-31 | 2004-02-30 |
Author |
Rating:
Johan Södercrantz
|
Title |
Test
Details
Pattern Title
|
Expression |
^(((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{3}|02/29/(([2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00)))$ |
Description |
MM/dd/yyyy with 100% leap year validation starting from year 2000.
If this one doesn't fit your needs, just tell me.
Sorry for starting "only" from year 2000, this is so simple to change this, please ask if needed.
Enjoy |
Matches |
02/29/2000 | 02/29/2004 | 12/31/2001 |
Non-Matches |
02/29/2100 | 02/29/2001 | 1/1/2001 |
Author |
Rating:
Dany Lauener
|
Title |
Test
Details
M/d/y Date
|
Expression |
^(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[13-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$ |
Description |
This expression validates dates in the US m/d/y format from 1/1/1600 - 12/31/9999. |
Matches |
01.1.02 | 11-30-2001 | 2/29/2000 |
Non-Matches |
02/29/01 | 13/01/2002 | 11/00/02 |
Author |
Rating:
Michael Ash
|
Displaying page
of
pages;
Items to