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 6 of 7 pages; Items 101 to 120
Title Test Details Pattern Title
Expression
^((((0?[13578])|(1[02]))[\/|\-]?((0?[1-9]|[0-2][0-9])|(3[01])))|(((0?[469])|(11))[\/|\-]?((0?[1-9]|[0-2][0-9])|(30)))|(0?[2][\/\-]?(0?[1-9]|[0-2][0-9])))[\/\-]?\d{2,4}$
Description
After looking for a date regular expression, I could not find one that meet my need, so I develop one that handles 1 or 2 digets in the month and day and also handle feb up to 29. This will allow both / and - for separators, which is what I needed. I hope this helps others too. Thanks, Cliff Schneide
Matches
1-31-02 | 2-29-04 | 08/1/2004
Non-Matches
2-30-04 | 6/31/04 | 13-11-2004
Author Rating: Not yet rated. Cliff Schneide
Title Test Details Pattern Title
Expression
^(([0-9])|([0-1][0-9])|([2][0-3])):(([0-9])|([0-5][0-9]))$
Description
reg. expr. 4 checking 24 time
Matches
1:59 | 01:59 | 23:59
Non-Matches
12:63 | 25:60 | 13.10
Author Rating: Not yet rated. Tomas Andrysek
Title Test Details Pattern Title
Expression
^(([0-9])|([0-1][0-9])|([2][0-3])):?([0-5][0-9])$
Description
For testing 24H based time entry. Tests if there is a colon to separate the hours from the minutes
Matches
0959 | 959 | 9:59
Non-Matches
90 | 960 | 24:00
Author Rating: Not yet rated. mana deys
Title Test Details Pattern Title
Expression
^\s*(?'num'\d+(\.\d+)?)\s*(?'unit'((w(eek)?)|(wk)|(d(ay)?)|(h(our)?)|(hr))s?)(\s*$)
Description
Validates Microsoft Project-type duration entries. Accepts a number and a unit. The number part can be integer or decimal. The unit can be several variations of weeks, days, and hours: e.g., w, wk, week, ws, wks, weeks are all valid. Whitespace between the number and the unit is optional: e.g., 1d, 2 days, 3.5w are all valid. Captures the number value in a group named num and the unit string in a group named 'unit'.
Matches
1 day | 3.5 w | 6hrs
Non-Matches
1 | 6. days | 1 week 2 d
Author Rating: Not yet rated. Steve Fisher
Title Test Details Pattern Title
Expression
^(([1-9]{1})|([0-1][1-2])|(0[1-9])|([1][0-2])):([0-5][0-9])(([aA])|([pP]))[mM]$
Description
Matches 12 hour time format
Matches
1:00Am | 12:59pM | 05:05pm
Non-Matches
00:00am | 05:60pm | 1:00
Author Rating: Not yet rated. jeremy chapman
Title Test Details Pattern Title
Expression
^((((19|20)(([02468][048])|([13579][26]))-02-29))|((20[0-9][0-9])|(19[0-9][0-9]))-((((0[1-9])|(1[0-2]))-((0[1-9])|(1\d)|(2[0-8])))|((((0[13578])|(1[02]))-31)|(((0[1,3-9])|(1[0-2]))-(29|30)))))$
Description
Based on some of the other patterns on RegExpLib. This is the ISO way of writing dates.
Matches
2002-01-31 | 1997-04-30 | 2004-01-01
Non-Matches
2002-01-32 | 2003-02-29 | 04-01-01
Author Rating: Not yet rated. Knut Hamang
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]))|((((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])))))/((19[0-9][0-9]))|(29/02/20(([02468][048])|([13579][26])))|(29/02/19(([02468][048])|([13579][26]))))$
Description
This expression is an improved version of Jörg Maag. It checks a date field in the Australian DD/MM/YYYY format. Besides, it also validates leap year between 1900 and 2099.
Matches
29/02/1992 | 29/02/2000 | 29/02/2004
Non-Matches
29/02/1892 | 29/02/2100 | 29/02/3004
Author Rating: Not yet rated. Yik Kheam Tan
Title Test Details Pattern Title
Expression
(^(((([1-9])|([0][1-9])|([1-2][0-9])|(30))\-([A,a][P,p][R,r]|[J,j][U,u][N,n]|[S,s][E,e][P,p]|[N,n][O,o][V,v]))|((([1-9])|([0][1-9])|([1-2][0-9])|([3][0-1]))\-([J,j][A,a][N,n]|[M,m][A,a][R,r]|[M,m][A,a][Y,y]|[J,j][U,u][L,l]|[A,a][U,u][G,g]|[O,o][C,c][T,t]|[D,d][E,e][C,c])))\-[0-9]{4}$)|(^(([1-9])|([0][1-9])|([1][0-9])|([2][0-8]))\-([F,f][E,e][B,b])\-[0-9]{2}(([02468][1235679])|([13579][01345789]))$)|(^(([1-9])|([0][1-9])|([1][0-9])|([2][0-9]))\-([F,f][E,e][B,b])\-[0-9]{2}(([02468][048])|([13579][26]))$)
Description
I have written this regular expression for use in javascript. It sould work for other languages directly or with minor changes. The parsing logic in this regular expression works like this : Imagine a tree structure, input at the root, Level 1 : two branches one-non Feb months two-Feb month. In the Feb month again two branches one-leap year Feb and two-non leap year Feb. In the non-Feb branch, we have two branches again, one-30 days month and two-31 days month. Once you get this, I think it will be easier to figure out the rest.
Matches
29-Feb-2000 | 1-jan-2007 | 31-dEC-1770
Non-Matches
32-Jan-2001 | 30-Feb-2004 | 0-nov-2004
Author Rating: Not yet rated. Moiz Tankiwala
Title Test Details Pattern Title
Expression
[-+]((0[0-9]|1[0-3]):([03]0|45)|14:00)
Description
This matches timezone offsets. Also matches non-hour offsets like India (+05:30) and Nepal (+5:45}. See for more timezone information: http://en.wikipedia.org/wiki/Time_zone
Matches
+00:00 | -05:00 | +13:45
Non-Matches
+14:30 | +01:14 | -09:55
Author Rating: Not yet rated. Robert van der Boon
Title Test Details Pattern Title
Expression
^(([1-9]{1})|([0-1][0-9])|([1-2][0-3])):([0-5][0-9])$
Description
Matches 24 hour time format.
Matches
00:00 | 23:59 | 10:10
Non-Matches
24:00 | 00:60 | 25:61
Author Rating: Not yet rated. jeremy chapman
Title Test Details Pattern Title
Expression
^(20|21|22|23|[01]\d|\d)(([:.][0-5]\d){1,2})$
Description
24 hour clock as prefered by MS-SQL, allows for shorter more human methods of writing time (no preceding zero or seconds required). MS-SQL prefers semi-colon although this accepts full stops for users ease of use.
Matches
09:00:00 | 09.00 | 9:00
Non-Matches
9:00AM
Author Rating: Not yet rated. Adam Smith
Title Test Details dd/mm/yyyy hhMMss Julian to Gregorian DateTime
Expression
(?#Datetime for Julian and Gregorian Calenders Matchs dates from 0045 BC to 9999 A.D. Days and months are 1 or 2 digits Years are 4 digit with leading zeros if required. February is validate in all leap years Leap year rules for Julian and Gregorian calendars http://scienceworld.wolfram.com/astronomy/LeapYear.html Missing days for 1582 and 1752 are not matched. Though only one set should be applied to a calendar since they are caused by when the calendar was adopted Missing days http://scienceworld.wolfram.com/astronomy/GregorianCalendar.html Time can be either 12 or 24 hour format 12 hour format hh:MM:ss AM|PM minutes and seconds are optional 24 hour format hh:mm:ss seconds are optional, hours less than ten require leading zero Datetome format is a date, a space then a time. ) (?#Calandar from January 1st 45 B.C. to December 31, 1999 in dd/mm/yyyy format) (?! (?:(?:0?[5-9]|1[0-4])(?<sep>[-./])10\k<sep>(?:1582))| #Missing days from 1582 (?:(?:0?[3-9]|1[0-3])(?<sep>[-./])0?9\k<sep>(?:1752)) #or Missing days from 1752 (?# both sets of missing days such not be in the same calendar so remove one or the other) ) (?n:^(?=\d) # the character at the beginning a the sring must be a digit ( (?<day>31(?!.0?[2469]|11)|30(?!.0?2)| 29(?(.0?2)(?=.0?2.(?! #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 (?!\x20BC))|(?:00(?:42|3[0369]|2[147]|1[258]|09)\x20BC)))|(?!.0?2))| 2[0-8]|1\d|0?[1-9]) (?<sep>[-./]) # choose a date separator (?<month> (0?[1-9])|1[012]) #end of month check (?# The maximum number of days allowed for a month has already been checked for in the month check. If you made it this far the number of day is within the range for the given month) \k<sep> # Match the same date separator choosen before. (?<year>(?=(?:00(?:4[0-5]|[0-3]?\d)\x20BC)|(?:\d{4}(?:\z|(?:\x20\d))))\d{4}(?:\x20BC)? # a four digit year. Use leading zeros if needed ) (?(?=\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
dd-mm-yyyy Datetime for AD, with leap year. See http://blogs.regexadvice.com/mash/archive/2004/04/23/1021.aspx for details on this and similar regexs
Matches
30-4-2004 | 29/2/2004 3:35 PM | 23:00:00
Non-Matches
1/31/2004 | 23:23 AM | 29/2/2005
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
^((31(?!\ (Apr(il)?|June?|(Sept|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)?|(Sept|Nov|Dec)(ember)?)\ ((1[6-9]|[2-9]\d)\d{2})$
Description
Matches
21 feb 2004
Non-Matches
30 feb2004
Author Rating: Not yet rated. anil agarwal
Title Test Details Pattern Title
Expression
(0[1-9]|[12][0-9]|3[01])\s(J(anuary|uly)|Ma(rch|y)|August|(Octo|Decem)ber)\s[1-9][0-9]{3}| (0[1-9]|[12][0-9]|30)\s(April|June|(Sept|Nov)ember)\s[1-9][0-9]{3}| (0[1-9]|1[0-9]|2[0-8])\sFebruary\s[1-9][0-9]{3}| 29\sFebruary\s((0[48]|[2468][048]|[13579][26])00|[0-9]{2}(0[48]|[2468][048]|[13579][26]))
Description
Verifies all valid Gregorian dates of the form DD MONTH YY, taking days/month and leap years into account.
Matches
09 March 2005 | 29 February 2004 | 31 December 9999
Non-Matches
32 March 2005 | 29 February 2005 | 2005-03-09
Author Rating: Not yet rated. Daniel Vandersluis
Title Test Details Pattern Title
Expression
(?n:^(?=\d)((?&lt;month&gt;(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])))(?&lt;sep&gt;[-./ ])(?&lt;day&gt;0?[1-9]|[12]\d|3[01])\k&lt;sep&gt;(?&lt;year&gt;(1[6-9]|[2-9]\d )\d{2})(?(?=\x20\d)\x20|$))?(?&lt;time&gt;((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
Matches
02/27/2005
Non-Matches
02/29/2005
Author Rating: Not yet rated. Abhinav Gupta
Title Test Details Pattern Title
Expression
(^([0-9]|[0-1][0-9]|[2][0-3]):([0-5][0-9])(\s{0,1})([AM|PM|am|pm]{2,2})$)|(^([0-9]|[1][0-9]|[2][0-3])(\s{0,1})([AM|PM|am|pm]{2,2})$)
Description
Matches
12:30PM
Non-Matches
1300
Author Rating: Not yet rated. Osaro bare
Title Test Details Pattern Title
Expression
^([0-1]?\d|2[0-3]):([0-5]\d)$
Description
Time in 24h format; minutes must be two digits; hours may be one or two digits
Matches
3:23 | 03:23 | 16:59
Non-Matches
12:2 | 12:76 | 33:12
Author Rating: Not yet rated. de kleine Gerardus
Title Test Details DateTime type format
Expression
(\d{2}|\d{4})(?:\-)?([0]{1}\d{1}|[1]{1}[0-2]{1})(?:\-)?([0-2]{1}\d{1}|[3]{1}[0-1]{1})(?:\s)?([0-1]{1}\d{1}|[2]{1}[0-3]{1})(?::)?([0-5]{1}\d{1})(?::)?([0-5]{1}\d{1})
Description
Will match a date accepted by MySQL datetime type. Years with 2 or 4 digits from any range. Months with 2 digits from 00 to 12. days with 2 digits from 00 to 31. Hours with 2 digits from 00-23 Minutes with 2 digits from 00 to 59. Seconds with 2 digits from 00 to 59.
Matches
00-00-00 00:00:00 | 0000-00-00 00:00:00 | 09-05-22 08:16:00 | 1970-00-00 00:00:00 | 20090522081600
Non-Matches
2009-13:01 00:00:00 | 2009-12-32 00:00:00 | 2002-12-31 24:00:00 | 2002-12-31 23:60:00 | 02-12-31 23:00:60
Author Rating: Not yet rated. João Batista Neto
Title Test Details Pattern Title
Expression
^(0{0,1}[1-9]|[12][0-9]|3[01])[- /.](0{0,1}[1-9]|1[012])[- /.](\d{2}|\d{4})$
Description
Validates dates formatted like &quot;dd.mm.yyyy&quot; or &quot;dd.mm.yy&quot;. Also the separators &quot;/&quot; and &quot;-&quot; are validated &quot;ok&quot;. This expression does not check leap years! I did this expression cause I could hardly find any date regex that supports those &quot;dot-formats&quot;.
Matches
1.1.2004 | 03.07.04 | 1-03-03
Non-Matches
0.13.2004 | 1.1.200 | 32.0.03
Author Rating: Not yet rated. Steve Wagner
Title Test Details Pattern Title
Expression
^(([0]?[1-9]|[1][0-2])[\/|\-|\.]([0-2]\d|[3][0-1]|[1-9])[\/|\-|\.]([2][0])?\d{2}\s+((([0][0-9]|[1][0-2]|[0-9])[\:|\-|\.]([0-5]\d)\s*([aApP][mM])?)|(([0-1][0-9]|[2][0-3]|[0-9])[\:|\-|\.]([0-5]\d))))$
Description
MM-DD-20YY HH:MM AP MM-DD-20YY H:MM AP MM-DD-20YY HH:MM MM-DD-20YY H:MM MM-DD-YY HH:MM AP MM-DD-YY H:MM AP MM-DD-YY HH:MM MM-DD-YY H:MM M-D-YY HH:MM AP M-D-YY H:MM AP M-D-YY HH:MM M-D-YY H:MM where - can be / or - or . where : can be : or - or . Definition: ^( ;Start of Line ([0]?[1-9]|[1][0-2]) ;00-09 or 10-12 or 1-9 [\/|\-|\.] ;/ or - or . ([0-2]\d|[3][0-1]|[1-9]) ;00-29 or 30-31 or 1-9 [\/|\-|\.] ;/ or - or . ([2][0])?\d{2} ;2000-2099 or 00-99 \s+ ;one or more spaces ( ;must be either 12H notation w/AM|PM ( ([0][0-9]|[1][0-2]|[0-9]) [\:|\-|\.] ;: or - or . ([0-5]\d) ;01 thru 59 \s* ;zero or more spaces ([aApP][mM])? ;nothing or AM or PM (case insensitive) ) | ;or 24H notation w/out AM|PM ( ([0-1][0-9]|[2][0-3]|[0-9]) ;00-19 or 20-23 [\:|\-|\.] ;: or - or . ([0-5]\d) ;00-59 ) ) )$ ;End of Line
Matches
01/01/2002 04:42 | 5-12-02 04:42 AM | 01.01/02 04-42aM
Non-Matches
01-12-1999 4:50PM | 01-12-2002 15:10PM | 01-12-002 8:20PM
Author Rating: Not yet rated. Bob Duffett
Change page:   |    Displaying page 6 of 7 pages; Items 101 to 120

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