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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find DD-MM-YYYY Format Date Validator
Expression
^((29-02-(19|20)(([02468][048])|([13579][26])))|(31-((0[13578])|(1[02]))|(30-((0[13456789])|(1[0-2])))|(29-((0[13456789])|(1[0-2])))|(((0[1-9]|)|(1[0-9])|(2[0-8]))-((0[1-9])|(1[0-2])))-((19|20)[0-9][0-9])))$
Description
This expression can be used to validate any date entered in correct DD-MM-YYYY format. Takes care of Leap Years too..
Matches
29-02-2008 | 30-04-2007 | 01-01-1975
Non-Matches
29-02-2007 | 31-11-2008 | 31-13-1999
Author Rating: Not yet rated. Arya K Choudhury
Source Independent
Your Rating
Bad Good

Enter New Comment

Title

Name

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: Leap year has error
Name: Michael Ash
Date: 1/9/2009 12:09:06 PM
Comment:
Your leap year check has an error. 1900 was not a leap year. Also you could also save a few keystrokes in your month checks by using [13-9] for 30th and non Feb 29th


Title: useful
Name: user
Date: 1/9/2009 2:07:22 AM
Comment:
good


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