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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Date-MM/DD/YYYY MONTH/DATE/YEAR
Expression
^((0[1-9])|(1[0-2]))\/((0[1-9])|(1[0-9])|(2[0-9])|(3[0-1]))\/(\d{4})$
Description
This regular expressions matches dates in the format MM/DD/YYYY where MM can be 01 to 12, DD can be 01 to 31 and YYYY is always 4 digits long.
Matches
12/25/2007 | 11/07/1517 | 02/25/2727
Non-Matches
1/27/1977 | 00/01/000 | 15/07/2002
Author Rating: The rating for this expression. Ravi Nandan Vaish
Source
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: doesn't handle days in February and leap years
Name: JC
Date: 10/29/2007 4:58:02 PM
Comment:
This regular expression would accept 2/30/2007. Is there an updated version to handle this?


Title: Not strict
Name: Michael Ash
Date: 4/19/2007 10:50:22 AM
Comment:
No check for days in month or leap years. Will match invalid dates


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