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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^((((0[13578])|([13578])|(1[02]))[\/](([1-9])|([0-2][0-9])|(3[01])))|(((0[469])|([469])|(11))[\/](([1-9])|([0-2][0-9])|(30)))|((2|02)[\/](([1-9])|([0-2][0-9]))))[\/]\d{4}$|^\d{4}$
Description
The following validates dates with and without leading zeros in the following formats: MM/DD/YYYY and it also takes YYYY (this can easily be removed). All months are validated for the correct number of days for that particular month except for February which can be set to 29 days. date day month year
Matches
01/01/2001 | 1/01/2001 | 2002
Non-Matches
2/30/2002 | 13/23/2002 | 12345
Author Rating: The rating for this expression. Matt Adams
Source Started with http://regexlib.com/REDetails.aspx?regexp_id=106
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: To refuse xx/00/xxxx
Name: Assami
Date: 10/24/2014 5:36:03 AM
Comment:
Replace the severals : ([0-2][0-9]) By : (0[1-9])|([12][0-9])


Title: To refuse xx/00/xxxx
Name: Assami
Date: 10/24/2014 5:33:30 AM
Comment:
Replace the severals : ([0-2][0-9]) By : (0[1-9])|([12][0-9])


Title: To refuse xx/00/xxxx
Name: Assami
Date: 10/24/2014 5:15:25 AM
Comment:
Replace the severals : ([0-2][0-9]) By : (0[1-9])|([12][0-9])


Title: To refuse xx/00/xxxx
Name: Assami
Date: 10/24/2014 5:11:43 AM
Comment:
Replace the severals : ([0-2][0-9]) By : (0[1-9])|([12][0-9])


Title: To refuse xx/00/xxxx
Name: Assami
Date: 10/24/2014 5:09:51 AM
Comment:
Replace the severals : ([0-2][0-9]) By : (0[1-9])|([12][0-9])


Title: Does not pass 01/00/2006.
Name: SUBBU
Date: 5/18/2014 12:35:34 AM
Comment:
This Expression is validating 01/00/2014 true..it's an error


Title: Does not pass 01/00/2006.
Name: tester
Date: 12/18/2009 7:06:52 PM
Comment:
01/00/2006?


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