- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Regular Expression Details

Title Test Find dd MMM yyyy Date
^((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})$
This RE validates dates in the dd MMM yyyy format. Spaces separate the values.
31 January 2003 | 29 March 2004 | 29 Feb 2008
Jan 1 2003 | 31 Sept 2003 | 29 February 2003
Author Rating: The rating for this expression. Michael Ash
Your Rating
Bad Good

Enter New Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Best Ever
Name: Peter
Date: 7/24/2012 7:53:40 AM
This is the best ever ,just righfor Asp DOTNET and SQL server is ready for this type of date already ..Excellent!

Title: sun
Name: suraj
Date: 7/24/2012 7:31:52 AM
sun are like

Title: RE: One bug
Name: Michael Ash
Date: 5/9/2009 11:12:53 PM
Ditty, this regex does indeed account for leap years as shown in the last sample match and non-match.

Title: One bug
Name: Ditty Dominique
Date: 3/17/2009 3:40:11 AM
This has a bug, it does not take into consideration leap years.

Date: 8/14/2008 10:48:34 AM

Title: Re: case insensitive modification & Sept
Name: Michael Ash
Date: 12/2/2005 2:43:24 PM
Thanks for the catch but the fix to allow Sep is not just placing a ? after Sept. That would allow Sepember to pass. Each instance of Sept would need to be Sep(?=\b|t)t? (?i:) will only work in serverside code. The options are not allowed in the pattern in JScipt, so what is valid serverside may not be clientside. I don't know how Asp.Net dealing with embedded options.

Title: case insensitive modification & Sept
Name: Rob Lauriston
Date: 12/2/2005 2:13:10 PM
tiny bug: Sep is rejected because ? is missing after Sept. What modification is needed to make this case insensitive? I tried adding ^(?i)( etc... at the beginning, and it works in some environments, but not as an ASP ValidationExpression System.Web.UI.WebControls.RegularExpressionValidator Visual Studio allows the syntax to be entered, but the debugger catches it. This is off the topic of the expression per se, but I thought I'd ask. Thanks for the expression!

Title: Its Good but i can' t understand it
Name: Ashok
Date: 11/22/2005 8:37:59 AM
Thnaks for information exactly what i looking for.... but if you place explanation then it is to be better for the persons ...

Title: Re: 2005/9/29 and don't be 2005/09/29
Name: Michael Ash
Date: 9/29/2005 11:42:44 PM
This regex only validate the date format pattern stated in the description. If you need another format please see

Title: what about 2005/9/29 and don't be 2005/09/29
Name: jspadmin
Date: 9/29/2005 8:35:39 PM
what about 2005/9/29 and don't be 2005/09/29?I need 2005/9/9 and 2005/9/10,I mean ,it will be automatically increased ,but with "0",how to assue?

Title: Focus on this website
Name: Jspadmin
Date: 9/29/2005 8:32:08 PM
I am from china,learning RegEx,this website may be useful

Title: Thanx alot Michael
Name: Amit Bajaj
Date: 9/2/2005 5:59:02 AM
Thanx for that RE. and making our job simpler.

Title: Re: Bug!
Name: Michael Ash
Date: 3/7/2005 4:41:37 PM
Fixed. Thanks for the catch.

Title: Bug!
Name: Try Feb 31
Date: 3/7/2005 4:02:03 PM
This expression allows Feb 31 - Ankesh Mehta

Title: Ideal for UK .net development
Name: Miles Doubleday
Date: 1/21/2005 7:22:31 AM
Exactly what I was looking for given that date validation in "UK" format doesn't work properly in the ASP.NET validation controls. Worked first time, thank you very much indeed.

Title: Re: how bout mm/dd/yyyy
Name: Michael Ash
Date: 10/27/2004 8:10:49 AM
Please see

Title: how bout mm/dd/yyyy
Name: amyan
Date: 10/27/2004 2:45:44 AM
i've managed so far, to change the "-" to a "/" heh, dat wasn't a guru thing, what i need help wid is how to format the remaining of it?

Title: re: This is similar to what I want
Name: Michael Ash
Date: 3/18/2004 1:48:27 AM
Here you go Danna. I just replaced the spaces with dashes. Just note the month names are case sensitive ^((31(?!-(Apr(il)?|June?|(Sept|Nov)(ember)?)))|((30|29)(?!-F eb(ruary)?))|(29(?=-Feb(ruary)?-(((1[6-9]|[2-9]\d)(0[48]|[24 68][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)(em ber)?)-((1[6-9]|[2-9]\d)\d{2})$

Title: Best Ever
Name: Peter
Date: 2/19/2004 11:24:47 AM
This is the best ever, just right for ASP DOTNET and SQL Server is ready for this type of date already. Excellent!

Title: askelent !
Name: Imran
Date: 10/13/2003 4:07:13 AM
fit !! great work :) thanks a lot

Copyright © 2001-2018, | ASP.NET Tutorials