RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Browse Expressions by Category

134 regular expressions found in this category!

Expressions in category: Dates and Times

Change page:   |    Displaying page 2 of 7 pages; Items 21 to 40
Title Test Details Pattern Title
Expression
^(?=\d)(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?:\x20|$))|(?:2[0-8]|1\d|0?[1-9]))([-./])(?:1[012]|0?[1-9])\1(?:1[6-9]|[2-9]\d)?\d\d(?:(?=\x20\d)\x20|$))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$
Description
DateTime Validator. This RE validates both dates and/or times patterns. Days in Feb. are also validated for Leap years. Dates: in dd/mm/yyyy or d/m/yy format between 1/1/1600 - 31/12/9999. Leading zeroes are optional. Date separators can be either matching dashes(-), slashes(/) or periods(.) Times: in the hh:MM:ss AM/PM 12 hour format (12:00 AM - 11:59:59 PM) or hh:MM:ss military time format (00:00:00 - 23:59:59). The 12 hour time format: 1) may have a leading zero for the hour. 2) Minutes and seconds are optional for the 12 hour format 3) AM or PM is required and case sensitive. Military time 1) must have a leading zero for all hours less than 10. 2) Minutes are manditory. 3) seconds are optional. Datetimes: combination of the above formats. A date first then a time separated by a space. ex) dd/mm/yyyy hh:MM:ss This RE is an variation of one of my other Datetime (mm/dd/yyyy) validator already in this library http://www.regexlib.com/REDetails.aspx?regexp_id=369, so the same rules for leap year apply. All 4 digit year and all two digit years except 00, which might not be a leap year.
Matches
31/12/2003 11:59:59 PM | 29-2-2004 | 01:45:02
Non-Matches
12/31/2003 | 29.02.2005 | 13:30 PM
Author Rating: The rating for this expression. Michael Ash
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: The rating for this expression. 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: The rating for this expression. Ariel Merrell
Title Test Details Pattern Title
Expression
(?&lt;Day&gt;[1-9]|[0-3][0-9])/(?&lt;Month&gt;[01][012]|[1-9]|0[1-9])/(?&lt;Year&gt;[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: The rating for this expression. yoram o
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: The rating for this expression. Markus Unterauer
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: The rating for this expression. 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}))|((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: The rating for this expression. Dany Lauener
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 &gt;=1900 &lt;=2999.
Matches
29/02/2004 | 31/01/1900 | 31/01/2999
Non-Matches
29/02/2003 | 12042004 | 20/04/04
Author Rating: The rating for this expression. Felipe Albacete
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: The rating for this expression. Morten Henriksen
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 &quot;Mike O Shea&quot; 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: The rating for this expression. Dany Lauener
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: The rating for this expression. Uris Virott
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&#227;o &#233; uma valida&#231;&#227;o de data simplicada onde n&#227;o aceita datas com ano inferior a 1900. Interessante pra valida&#231;&#227;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: The rating for this expression. Fabiano Santiago
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: The rating for this expression. Michael Ash
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: The rating for this expression. Sung Lee
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: The rating for this expression. 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: The rating for this expression. Rohan Pathare
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: The rating for this expression. Michael Ash
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 &amp; 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: The rating for this expression. yoram o
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: The rating for this expression. mike harber
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: The rating for this expression. Michael Ash
Change page:   |    Displaying page 2 of 7 pages; Items 21 to 40

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials