134 regular expressions found in this category!
Displaying page
of
pages;
Items to
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
Validate 12hour clock
|
Expression |
(?<Time>^(?:0?[1-9]:[0-5]|1(?=[012])\d:[0-5])\d(?:[ap]m)?) |
Description |
A co-worker needed a regex to validate time. He could only find patterns that match a 24hour clock. I whipped this expression up to validate a 12hour clock. Hope somebody finds it useful. |
Matches |
12:00am | 01:30pm | 4:59 |
Non-Matches |
15:30 | 4:78am | 00:00 |
Author |
Rating:
Ariel Merrell
|
Title |
Test
Details
Pattern Title
|
Expression |
(?<Day>[1-9]|[0-3][0-9])/(?<Month>[01][012]|[1-9]|0[1-9])/(?<Year>[12]\d{3}|\d{2})
|
Description |
DD/MM/YY
D/M/YY
DD/MM/YYYY |
Matches |
15/05/2004 | 15/5/04 |
Non-Matches |
15/45/04 |
Author |
Rating:
yoram o
|
Title |
Test
Details
Pattern Title
|
Expression |
(?<Day>[0-3][0-9]|[1-9])/(?<Month>[1-9]|1[0-2]|0[1-9])/(?<Year>[12]\d{3}|\d{2}) |
Description |
evaluates dates in the format of DD/MM/YY or DD/MM/YYYY
DD & YY - can be of the form:
One digit 2
Zero leading 02 |
Matches |
1/3/98 | 01/03/04 |
Non-Matches |
15/20/04 | 1/13/04 | 12/02/ |
Author |
Rating:
yoram o
|
Title |
Test
Details
A.D. Calendar dates
|
Expression |
(?#Calandar from January 1st 1 A.D to December 31, 9999 )(?# in yyyy-mm-dd format )(?!(?:1582\D10\D(?:0?[5-9]|1[0-4]))|(?#Missing days from 1582 )(?:1752\D0?9\D(?:0?[3-9]|1[0-3]))(?#or Missing days from 1752 )(?# both sets of missing days should not be in the same calendar so remove one or the other))(?n:^(?=\d)(?# the character at the beginning a the string must be a digit )((?'year'\d{4})(?'sep'[-./])(?'month'0?[1-9]|1[012])\k'sep'(?'day'(?<!(?:0?[469]|11).)31|(?<!0?2.)30|2[0-8]|1\d|0?[1-9]|(?# if feb 29th check for valid leap year )(?:(?<=(?!(?#exclude these years from leap year pattern ) 000[04](?#No year 0 and no leap year in year 4 )|(?:(?:1[^0-6]|[2468][^048]|[3579][^26])00)(?# centurial years > 1500 not evenly divisible by 400 are not leap year))(?:(?:\d\d)(?# century)(?:[02468][048]|[13579][26])(?#leap years))\k'sep'(?:0?2)\k'sep')|(?# else if not Feb 29 )(?<!\k'sep'(?:0?2)\k'sep')(?# and day not Feb 30 or 31 ))29)(?(?=\x20\d)\x20|$))?(?# if there is a space followed by a digit check for time )(?<time>((?# 12 hour format )(0?[1-9]|1[012])(?# hours )(:[0-5]\d){0,2}(?# optional minutes and seconds )(?i:\x20[AP]M)(?# required AM or PM ))|(?# 24 hour format )([01]\d|2[0-3])(?#hours )(:[0-5]\d){1,2})(?#required minutes optional seconds )?$) |
Description |
yyyy-mm-dd Datetime for AD, with leap year. See http://blogs.regexadvice.com/mash/archive/2004/04/23/1021.aspx for details on similar regexs |
Matches |
0001-06-16 12:00:01 AM | 2004/2/29 | 3:30 PM |
Non-Matches |
9999/99/99 | 24:00:00 | 2003-02-29 |
Author |
Rating:
Michael Ash
|
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}|\d))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}|\d))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00|[048])))$ |
Description |
This regexp has been posted specialy for "Mike O Shea" as he requested a mono digit year validation.
matches DD/MM/Y or DD/MM/YYYY or D/M/Y or DD/M/YYYY
Leap years treated. (Italian style with tomato)
Years 0-9 equal years 2000 to 2009 for leap years |
Matches |
1/1/2005 | 29/02/12 | 29/02/2400 |
Non-Matches |
29/2/2005 | 29/02/13 | 29/02/2200 |
Author |
Rating:
Dany Lauener
|
Title |
Test
Details
Pattern Title
|
Expression |
^(?=\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})?$ |
Description |
yyyy/mm/dd hh:MM:ss Datetime for all AD years, including leap years.
Javascript safe version of http://regexlib.com/REDetails.aspx?regexp_id=760. Please see that regex for details of what is being checked |
Matches |
0008-02-29 | 2:34:59 PM | 9999/12/31 11:59 PM |
Non-Matches |
04/04/04 | 1:00 | 1999/1/32 |
Author |
Rating:
Michael Ash
|
Title |
Test
Details
Pattern Title
|
Expression |
^((31(?! (FEB|APR|JUN|SEP|NOV)))|((30|29)(?! FEB))|(29(?= FEB (((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])-(JAN|FEB|MAR|MAY|APR|JUL|JUN|AUG|OCT|SEP|NOV|DEC)-((1[6-9]|[2-9]\d)\d{2})$ |
Description |
Mathces in format DD-MON-YYYY (hyphen between results). Validates for leap years. Ensures month is in uppercase. |
Matches |
9-MAY-1981 | 29-FEB-2004 | 25-DEC-1999 |
Non-Matches |
09 MAY 1981 | 06 Jul 2003 |
Author |
Rating:
Rohan Pathare
|
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)))$ |
Description |
DD.MM.YY or DD.MM.YYYY
separator could be on choice '.' '/' or '-'
leap years compatible, 00 is treated as year 2000. |
Matches |
29.2.04 | 29/02-2004 | 3.4.05 |
Non-Matches |
29.2.03 | 2902.2004 | 12.31.1975 |
Author |
Rating:
Dany Lauener
|
Title |
Test
Details
Pattern Title
|
Expression |
^([0-1]?[0-9]|[2][0-3]):([0-5][0-9])$ |
Description |
Accepts data of time in format h:mm and hh:mm
^([0-1]?[0-9]|[2][0-3]):([0-5][0-9])$
in php [0-23]:[0-59]{2} (posix) |
Matches |
0:00 | 23:00 | 00:59 |
Non-Matches |
0:0 | 24:00 | 00:60 |
Author |
Rating:
Morten Henriksen
|
Title |
Test
Details
Pattern Title
|
Expression |
((([0][1-9]|[12][\d])|[3][01])[-/]([0][13578]|[1][02])[-/][1-9]\d\d\d)|((([0][1-9]|[12][\d])|[3][0])[-/]([0][13456789]|[1][012])[-/][1-9]\d\d\d)|(([0][1-9]|[12][\d])[-/][0][2][-/][1-9]\d([02468][048]|[13579][26]))|(([0][1-9]|[12][0-8])[-/][0][2][-/][1-9]\d\d\d) |
Description |
Date validation in the dd/mm/yyyy format for years 1000+ (i.e 999 or 0999 not matching) and taking february leap years into account. |
Matches |
12/12/2003 | 29-02-2004 | 31-03-1980 |
Non-Matches |
29/02/2003 | 31-04-2002 | 10-10-0999 |
Author |
Rating:
Uris Virott
|
Title |
Test
Details
dd MMM yyyy Date
|
Expression |
^((31(?!\ (Feb(ruary)?|Apr(il)?|June?|(Sep(?=\b|t)t?|Nov)(ember)?)))|((30|29)(?!\ Feb(ruary)?))|(29(?=\ Feb(ruary)?\ (((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])\ (Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\b|t)t?|Nov|Dec)(ember)?)\ ((1[6-9]|[2-9]\d)\d{2})$ |
Description |
This RE validates dates in the dd MMM yyyy format. Spaces separate the values. |
Matches |
31 January 2003 | 29 March 2004 | 29 Feb 2008 |
Non-Matches |
Jan 1 2003 | 31 Sept 2003 | 29 February 2003 |
Author |
Rating:
Michael Ash
|
Title |
Test
Details
DateTime M/d/y hh:mm:ss
|
Expression |
^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-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}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$ |
Description |
DateTime Validator. |
Matches |
12/25/2003 | 08:03:31 | 02/29/2004 12 AM |
Non-Matches |
02/29/2003 1:34 PM | 13:23 PM | 24:00:00 |
Author |
Rating:
Michael Ash
|
Title |
Test
Details
Pattern Title
|
Expression |
(0?[1-9]|[12][0-9]|3[01])[/ -](0?[1-9]|1[12])[/ -](19[0-9]{2}|[2][0-9][0-9]{2}) |
Description |
Essa expressão é uma validação de data simplicada onde não aceita datas com ano inferior a 1900. Interessante pra validação de data de idade, data atual, etc |
Matches |
25/11/1979 | 5-12-2004 | 5 2 1901 |
Non-Matches |
25/11/1899 | 9-12-1700 | 25111979 |
Author |
Rating:
Fabiano Santiago
|
Title |
Test
Details
Pattern Title
|
Expression |
(((0[1-9]|[12][0-9]|3[01])([/])(0[13578]|10|12)([/])([1-2][0,9][0-9][0-9]))|(([0][1-9]|[12][0-9]|30)([/])(0[469]|11)([/])([1-2][0,9][0-9][0-9]))|((0[1-9]|1[0-9]|2[0-8])([/])(02)([/])([1-2][0,9][0-9][0-9]))|((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 |
This is the Brazilian Date Format.
DD/MM/YYYY with the right days per month.
Dates >=1900 <=2999. |
Matches |
29/02/2004 | 31/01/1900 | 31/01/2999 |
Non-Matches |
29/02/2003 | 12042004 | 20/04/04 |
Author |
Rating:
Felipe Albacete
|
Title |
Test
Details
Pattern Title
|
Expression |
^((\d{2}(([02468][048])|([13579][26]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|([1-2][0-9])))))|(\d{2}(([02468][1235679])|([13579][01345789]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\s(((0?[1-9])|(1[0-2]))\:([0-5][0-9])((\s)|(\:([0-5][0-9])\s))([AM|PM|am|pm]{2,2})))?$ |
Description |
Matches ANSI SQL date format YYYY-mm-dd hh:mi:ss am/pm. You can use / - or space for date delimiters, so 2004-12-31 works just as well as 2004/12/31. Checks leap year from 1901 to 2099. |
Matches |
2004-2-29 | 2004-02-29 10:29:39 pm | 2004/12/31 |
Non-Matches |
2003-2-29 | 2003-13-02 | 2003-2-2 10:72:30 am |
Author |
Rating:
Sung Lee
|
Title |
Test
Details
mm/dd/yyyy hh:MM:ss AM/PM DateTime
|
Expression |
(?n:^(?=\d)((?<month>(0?[13578])|1[02]|(0?[469]|11)(?!.31)|0?2(?(.29)(?=.29.((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[3579][26])00))|(?!.3[01])))(?<sep>[-./])(?<day>0?[1-9]|[12]\d|3[01])\k<sep>(?<year>(1[6-9]|[2-9]\d)\d{2})(?(?=\x20\d)\x20|$))?(?<time>((0?[1-9]|1[012])(:[0-5]\d){0,2}(?i:\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$) |
Description |
New DateTime Regex. Rebuilt better than before, better, stronger, faster. |
Matches |
1/31/2002 10 AM | 2/29/2004 | 4:15:04 PM |
Non-Matches |
2/29/2003 | 12/32/2003 | 4:00 |
Author |
Rating:
Michael Ash
|
Title |
Test
Details
Pattern Title
|
Expression |
^(([1-9]|[0-2]\d|[3][0-1])\.([1-9]|[0]\d|[1][0-2])\.[2][0]\d{2})$|^(([1-9]|[0-2]\d|[3][0-1])\.([1-9]|[0]\d|[1][0-2])\.[2][0]\d{2}\s([1-9]|[0-1]\d|[2][0-3])\:[0-5]\d)$ |
Description |
Correct German DateTime. Does not check leap year rules!
Possible Formats of date part:
D.M.YYYY or D.MM.YYYY or DD.MM.YYYY or DD.M.YYYY
Possible formats of time part:
h:mm or hh:mm |
Matches |
20.10.2003 08:10 | 24.12.2003 | 1.1.2004 8:15 |
Non-Matches |
25.13.2004 | 20.10.2003 08:9 |
Author |
Rating:
Markus Unterauer
|
Title |
Test
Details
Pattern Title
|
Expression |
((^(10|12|0?[13578])(3[01]|[12][0-9]|0?[1-9])((1[8-9]\d{2})|([2-9]\d{3}))$)|(^(11|0?[469])(30|[12][0-9]|0?[1-9])((1[8-9]\d{2})|([2-9]\d{3}))$)|(^(0?2)(2[0-8]|1[0-9]|0?[1-9])((1[8-9]\d{2})|([2-9]\d{3}))$)|(^(0?2)(29)([2468][048]00)$)|(^(0?2)(29)([3579][26]00)$)|(^(0?2)(29)([1][89][0][48])$)|(^(0?2)(29)([2-9][0-9][0][48])$)|(^(0?2)(29)([1][89][2468][048])$)|(^(0?2)(29)([2-9][0-9][2468][048])$)|(^(0?2)(29)([1][89][13579][26])$)|(^(0?2)(29)([2-9][0-9][13579][26])$)) |
Description |
Matches on MMDDYYYY only, requires all 8 digits |
Matches |
01012003 | 02292000 |
Non-Matches |
01/01/2003 |
Author |
Rating:
mike harber
|
Title |
Test
Details
Pattern Title
|
Expression |
(((0[123456789]|10|11|12)([/])(([1][9][0-9][0-9])|([2][0-9][0-9][0-9])))) |
Description |
This is an new data Validation to MM/YYYY from 1900 to 2999 this is an validation expression to Client From MOnth/Year. |
Matches |
01/1900 | 10/1990 | 12/2999 |
Non-Matches |
1/1900 | 12/1899 | 01/3000 |
Author |
Rating:
Felipe Albacete
|
Displaying page
of
pages;
Items to