Displaying page
of
pages;
Items to
| 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 |
^([0-1][0-9]|[2][0-3]):([0-5][0-9])$ |
| Description |
Matches a string if it is a valid time in the format of HH:MM |
| Matches |
02:04 | 16:56 | 23:59 |
| Non-Matches |
02:00 PM | PM2:00 | 24:00 |
| Author |
Rating:
Not yet rated.
Koen Hoorelbeke
|
| 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 |
^(([1-9])|(0[1-9])|(1[0-2]))\/((0[1-9])|([1-31]))\/((\d{2})|(\d{4}))$ |
| Description |
Matches U.S. dates with leading zeros and without and with 2 or four digit years |
| Matches |
01/01/2001 | 1/1/2001 | 01/1/01 |
| Non-Matches |
13/01/2001 | 1/2/100 | 09/32/2001 |
| Author |
Rating:
Chris Becker
|
| Title |
Test
Details
Pattern Title
|
| Expression |
((\d{2})|(\d))\/((\d{2})|(\d))\/((\d{4})|(\d{2})) |
| Description |
This matches simple dates against 1 or 2 digits for the month, 1 or 2 digit for the day, and either 2 or 4 digits for the year |
| Matches |
4/5/91 | 04/5/1991 | 4/05/89 |
| Non-Matches |
4/5/1 |
| Author |
Rating:
Andrew Lader
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(^|\s|\()((([1-9]){1}|([0][1-9]){1}|([1][012]){1}){1}[\/-]((2[0-9]){1}|(3[01]){1}|([01][1-9]){1}|([1-9]){1}){1}[\/-](((19|20)([0-9][0-9]){1}|([0-9][0-9]){1})){1}(([\s|\)|:])|(^|\s|\()((([0-9]){1}|([0][1-9]){1}|([1][012]){1}){1}[\/-](([11-31]){1}|([01][1-9]){1}|([1-9]){1}){1}[\/-](((19|20)([0-9][0-9]){1}|([0-9][0-9]){1})){1}(([\s|\)|:|$|\>])){1}){1}){1}){1} |
| Description |
Will match the following date formats: Preceded by a Space, Left-parentheses, or at the beginning of a line. Followed by a Space, Right-parentheses, or Colon(:), word boundary or End of line. Can have / or - as separator. Accepts 2 digit year 00-99 or 4 digit years 1900-2099 (can modify to accept any range) |
| Matches |
01/01/2001 | 01-01-2001: | (1-1-01) |
| Non-Matches |
13/1/2001 | 1-32-2001 | 1-1-1801 |
| Author |
Rating:
David Good
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(([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]))$ |
| Description |
Dates
day: d or dd, <= 31,
month: m or mm, <= 12,
year: yy or yyyy >= 1900, <= 2099
|
| Matches |
01/01/2001 | 1/1/1999 | 10/20/2080 |
| Non-Matches |
13/01/2001 | 1/1/1800 | 10/32/2080 |
| Author |
Rating:
Scott Thompson
|
| Title |
Test
Details
Pattern Title
|
| Expression |
((0?[13578]|10|12)(-|\/)((0[0-9])|([12])([0-9]?)|(3[01]?))(-|\/)((\d{4})|(\d{2}))|(0?[2469]|11)(-|\/)((0[0-9])|([12])([0-9]?)|(3[0]?))(-|\/)((\d{4}|\d{2}))) |
| Description |
Regex used in .NET to validate a date. Matches the following formats mm/dd/yy, mm/dd/yyyy, mm-dd-yy, mm-dd-yyyy
This covers days with 30 or 31 days but does not handle February, it is allowed 30 days. |
| Matches |
1/31/2002 | 04-30-02 | 12-01/2002 |
| Non-Matches |
2/31/2002 | 13/0/02 | Jan 1, 2001 |
| Author |
Rating:
Sean McAnally
|
| Title |
Test
Details
Pattern Title
|
| Expression |
20\d{2}(-|\/)((0[1-9])|(1[0-2]))(-|\/)((0[1-9])|([1-2][0-9])|(3[0-1]))(T|\s)(([0-1][0-9])|(2[0-3])):([0-5][0-9]):([0-5][0-9]) |
| Description |
Sql date format tester. |
| Matches |
2099-12-31T23:59:59 | 2002/02/09 16:30:00 | 2000-01-01T00:00:00 |
| Non-Matches |
2000-13-31T00:00:00 | 2002/02/33 24:00:00 | 2000-01-01 60:00:00 |
| Author |
Rating:
Peter Pfeifer
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^\d{4}[\-\/\s]?((((0[13578])|(1[02]))[\-\/\s]?(([0-2][0-9])|(3[01])))|(((0[469])|(11))[\-\/\s]?(([0-2][0-9])|(30)))|(02[\-\/\s]?[0-2][0-9]))$ |
| Description |
- validates a yyyy-mm-dd, yyyy mm dd, or yyyy/mm/dd date
- makes sure day is within valid range for the month
- does NOT validate Feb. 29 on a leap year, only that Feb. CAN have 29 days |
| Matches |
0001-12-31 | 9999 09 30 | 2002/03/03 |
| Non-Matches |
0001\02\30 | 9999.15.01 | 2002/3/3 |
| Author |
Rating:
Rex Po
|
| 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
Pattern Title
|
| Expression |
^( [1-9]|[1-9]|0[1-9]|10|11|12)[0-5]\d$ |
| Description |
Matches a 12-hour time value expressed as either 4 numeric digits, 3 numeric digits, or a space and 3 numeric digits. 3 digit times (930) can be expressed with leading 0's (0930) or not. AM/PM designation is not included in this expression. |
| Matches |
1145 | 933 | 801 |
| Non-Matches |
0000 | 1330 | 8:30 |
| Author |
Rating:
Not yet rated.
Steven Smith
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^\d{1,2}\/\d{2,4}$ |
| Description |
Accepts 1-2 digits followed by a slash followed by 2-4 digits. Useful for numeric month/year entry. |
| Matches |
9/02 | 09/2002 | 09/02 |
| Non-Matches |
Fall 2002 | Sept 2002 |
| Author |
Rating:
Not yet rated.
Mike Hensley
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(|(0[1-9])|(1[0-2]))\/((0[1-9])|(1\d)|(2\d)|(3[0-1]))\/((\d{4}))$ |
| Description |
This expression matches dates formatted as MM/DD/YYYY where months and days must be 2 digits each, zero padded. It is not perfect - it allows DD to be from 01 to 31 regardless of the month. |
| Matches |
01/01/2001 | 02/30/2001 | 12/31/2002 |
| Non-Matches |
1/1/02 | 1/1/2002 | 1/25/2002 |
| Author |
Rating:
Not yet rated.
Steven Smith
|
| 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][1-9]|3[01])\.(0?[13578]|1[02])\.20[0-9]{2}|(0?[1-9]|[12][1-9]|30)\.(0?[13456789]|1[012])\.20[0-9]{2}|(0?[1-9]|1[1-9]|2[0-8])\.(0?[123456789]|1[012])\.20[0-9]{2}|(0?[1-9]|[12][1-9])\.(0?[123456789]|1[012])\.20(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96))$ |
| Description |
Fully functional date validator in format dd.MM.yyyy
Works only within range of years 2000-2099 !
It allows leading zeros but does not require them. The last year pattern (enumeration) is not very clever but I will improve it, if needed. |
| Matches |
31.01.2002 | 29.2.2004 | 09.02.2005 |
| Non-Matches |
31.11.2002 | 29.2.2002 | 33.06.2000 |
| Author |
Rating:
Dalibor Kalna
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(0[1-9]|1[0-2])\/((0[1-9]|2\d)|3[0-1])\/(19\d\d|200[0-3])$ |
| Description |
This expression is an attempt to match the most obvious features of a valid date in American/US format of the form mm/dd/yyyy for any year 1900 through 2003. It can easily be adapted for different date ranges. It matches any date where the day part is any number 01-31, the month part is any number 01-12, and the year part is any number 1900-2003. The only invalid dates that it matches are ones where the day part may be in the range 01-31 but that range might not be valid for the specified month. An example of an invalid date that it would allow to pass through would be 11/31/2002. This date is invalid because 11/31 of any year does not exist, but this expression would allow it pass through since the day part is in the range 01-31.
This regular expression has been used successfully in ASP with VBScript using the windows scripting library RegExp object. |
| Matches |
12/31/2003 | 01/01/1900 | 11/31/2002 |
| Non-Matches |
1/1/2002 | 01/01/02 | 01/01/2004 |
| Author |
Rating:
Not yet rated.
Josh Bailyr
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^((((([13578])|(1[0-2]))[\-\/\s]?(([1-9])|([1-2][0-9])|(3[01])))|((([469])|(11))[\-\/\s]?(([1-9])|([1-2][0-9])|(30)))|(2[\-\/\s]?(([1-9])|([1-2][0-9]))))[\-\/\s]?\d{4})(\s((([1-9])|(1[02]))\:([0-5][0-9])((\s)|(\:([0-5][0-9])\s))([AM|PM|am|pm]{2,2})))?$ |
| Description |
This expression can be used validate a datetime column from SQL Server. Big parts of it where taken from other samples on RegexLib. Please feel free to take it apart and improve it. |
| Matches |
3/3/2003 | 3/3/2002 3:33 pm | 3/3/2003 3:33:33 am |
| Non-Matches |
13/1/2002 | 3/3/2002 3:33 | 31/3/2002 |
| Author |
Rating:
Not yet rated.
Scott Watermasysk Watermasysk
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^((((0[13578])|([13578])|(1[02]))[\/](([1-9])|([0-2][0-9])|(3[01])))|(((0[469])|([469])|(11))[\/](([1-9])|([0-2][0-9])|(30)))|((2|02)[\/](([1-9])|([0-2][0-9]))))[\/]\d{4}$|^\d{4}$ |
| Description |
The following validates dates with and without leading zeros in the following formats: MM/DD/YYYY and it also takes YYYY (this can easily be removed). All months are validated for the correct number of days for that particular month except for February which can be set to 29 days. date day month year |
| Matches |
01/01/2001 | 1/01/2001 | 2002 |
| Non-Matches |
2/30/2002 | 13/23/2002 | 12345 |
| Author |
Rating:
Not yet rated.
Matt Adams
|
| 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