134 regular expressions found in this category!
Displaying page
of
pages;
Items to
Title |
Test
Details
Months
|
Expression |
^(?:J(anuary|u(ne|ly))|February|Ma(rch|y)|A(pril|ugust)|(((Sept|Nov|Dec)em)|Octo)ber)$ |
Description |
This RE validate the full name of the months. |
Matches |
January | May | October |
Non-Matches |
Jan | Septem | Octo |
Author |
Rating:
Michael Ash
|
Title |
Test
Details
Pattern Title
|
Expression |
^([01]\d|2[0123])([0-5]\d){2}$ |
Description |
HHmmss without any separators. Hours in 24h format. |
Matches |
235959 | 000000 | 012345 |
Non-Matches |
240000 | 23:59:59 | 236060 |
Author |
Rating:
Dany Lauener
|
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\d)|(2[0-8]))-((0[1-9])|(1[0-2])))|((31-((0[13578])|(1[02])))|((29|30)-((0[1,3-9])|(1[0-2])))))-((20[0-9][0-9]))|(29-02-20(([02468][048])|([13579][26]))))$ |
Description |
This expression validates a date field in the European DD-MM-YYYY format. Days are validate for the given month and year. |
Matches |
05-01-2002 | 29-02-2004 | 31-12-2002 |
Non-Matches |
1-1-02 | 29-02-2002 | 31-11-2002 |
Author |
Rating:
Jörg Maag
|
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)/(19|[2-9]\d)\d{2}|0?2/29/((19|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00)))$ |
Description |
MM/dd/yyyy with 100% leap years. Valid since year 1900.
MM and DD could have 1 or 2 digits : M/d/yyyy or MM/d/yyyy or M/dd/yyyy
This was a request from a user in http://www.regexlib.com/REDetails.aspx?regexp_id=1038 |
Matches |
01/31/1905 | 1/9/1900 | 2/29/1904 |
Non-Matches |
31/01/2005 | 02/29/2005 | 2/29/2005 |
Author |
Rating:
Dany Lauener
|
Title |
Test
Details
Pattern Title
|
Expression |
^([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)$ |
Description |
yyyyMMdd with leap year validation, starting from year 2000 only.
The length of the expression is minimized, but still validates all entries.
If you want it with years like 1600 or separators, just ask :) |
Matches |
20000101 | 20051231 | 20040229 |
Non-Matches |
19990101 | 20053112 | 20050229 |
Author |
Rating:
Dany Lauener
|
Title |
Test
Details
Pattern Title
|
Expression |
^([1-9]|1[0-2]|0[1-9]){1}(:[0-5][0-9][aApP][mM]){1}$ |
Description |
Very simple expression to validate time on a 12 hour clock, this expression is valid for client-side script validations (RegularExpressionValidator - ASP.NET). |
Matches |
08:00AM | 10:00am | 7:00pm |
Non-Matches |
13:00pm | 12:65am |
Author |
Rating:
Roberto Hernández
|
Title |
Test
Details
Pattern Title
|
Expression |
^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$ |
Description |
dd/MM/yyyy with leap years 100% integrated Valid years : from 1900 to 9999.
As usual, many tests have been made.
This was requested by a user :
http://www.regexlib.com/REDetails.aspx?regexp_id=409 |
Matches |
29/02/2000 | 30/04/2003 | 01/01/2003 |
Non-Matches |
29/02/2001 | 30-04-2003 | 1/1/1899 |
Author |
Rating:
Dany Lauener
|
Title |
Test
Details
Pattern Title
|
Expression |
^(((((((0?[13578])|(1[02]))[\.\-/]?((0?[1-9])|([12]\d)|(3[01])))|(((0?[469])|(11))[\.\-/]?((0?[1-9])|([12]\d)|(30)))|((0?2)[\.\-/]?((0?[1-9])|(1\d)|(2[0-8]))))[\.\-/]?(((19)|(20))?([\d][\d]))))|((0?2)[\.\-/]?(29)[\.\-/]?(((19)|(20))?(([02468][048])|([13579][26])))))$ |
Description |
Simple American date format mm-dd-yyyy or mm-dd-yy, no time. Date range is 1900 --> 2099. Is enough for my purposes. Incorectly validates 02-29-1900. I created this to validate dates on a web form where the likely range will be 2000-->2020. Seperators can be '.','/' or '-'
Anyone know the rules for operator precedence for regex syntax? |
Matches |
02-29-2004 | 1/31/1997 | 1-2-03 |
Non-Matches |
02-29-2003 | 04-31-2003 | 31-03-05 |
Author |
Rating:
Neil Walls
|
Title |
Test
Details
Pattern Title
|
Expression |
^((0[1-9])|(1[0-2]))$ |
Description |
Matches month, requires that months 1-9 have a leading 0 |
Matches |
01 | 02 | 12 |
Non-Matches |
1 | 2 | 13 |
Author |
Rating:
Tim Macrina
|
Title |
Test
Details
Pattern Title
|
Expression |
^([0]?[1-9]|[1][0-2])[./-]([0]?[1-9]|[1|2][0-9]|[3][0|1])[./-]([0-9]{4}|[0-9]{2})$ |
Description |
Validate american date formats: mm/dd/yyyy or m/d/yy or m.d.yyyy with separators: . - /
Valid dates only! m (1-12)/ d (1-31)/ y (0..)
(rizzipereira.com.br)
For Brazilian date format: http://www.regexlib.com/REDetails.aspx?regexp_id=250 |
Matches |
10.03.1979 | 12/30/2004 | 01/01/2004 |
Non-Matches |
09--02--2004 | 15-15-2004 | 13/12/2004 |
Author |
Rating:
Diego dos Santos
|
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 |
^(([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
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
|
Title |
Test
Details
Pattern Title
|
Expression |
(^([0-9]|[0-1][0-9]|[2][0-3]):([0-5][0-9])$)|(^([0-9]|[1][0-9]|[2][0-3])$) |
Description |
Matches a string if it is a valid time in the format of HH:MM / H:MM / HH / H |
Matches |
10:35 | 9:20 | 23 |
Non-Matches |
24:00 | 20 PM | 20:15 PM |
Author |
Rating:
Nacho Varas
|
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 |
^(((\d{4})(0[13578]|10|12)(0[1-9]|[12][0-9]|3[01]))|((\d{4})(0[469]|11)([0][1-9]|[12][0-9]|30))|((\d{4})(02)(0[1-9]|1[0-9]|2[0-8]))|(([02468][048]00)(02)(29))|(([13579][26]00) (02)(29))|(([0-9][0-9][0][48])(02)(29))|(([0-9][0-9][2468][048])(02)(29))|(([0-9][0-9][13579][26])(02)(29))|(00000000)|(88888888)|(99999999))?$ |
Description |
it's for date in the format: "yyyymmdd" and it validates the empty string and some special values (00000000,88888888,99999999) but you can delete these last values. It works with leap years. |
Matches |
20041212 | 20040229 | 88888888 |
Non-Matches |
20040230 | 20041330 |
Author |
Rating:
Artu
|
Title |
Test
Details
MMM dd, yyyy Date
|
Expression |
^(?:(((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})) |
Description |
This RE validate Dates in the MMM dd, yyyy format from Jan 1, 1600 to Dec 31, 9999. The format is as follows: The name or 3 letter abbreivation, without a period, of the month, then a space then the day value then a comma then a space finally the year. The correct number of day are validated for each month include leap years. The name of month is case sensitive. |
Matches |
Jan 1, 2003 | February 29, 2004 | November 02, 3202 |
Non-Matches |
Feb 29, 2003 | Apr 31, 1978 | jan 33,3333 |
Author |
Rating:
Michael Ash
|
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
|
Displaying page
of
pages;
Items to