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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^([01][012]|0[1-9])/([0-2][0-9]|[3][0-1])/([0-9][0-9][0-9][0-9])$
Description
Regular expression that only allows expression in the format: MM/DD/YYYY
Matches
01/01/2004
Non-Matches
1/1/04 | 01/01/04 | 03/32/2004
Author Rating: The rating for this expression. David Vander Leest
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: Just what I needed!
Name: Ejen
Date: 7/18/2006 4:36:55 AM
Comment:
Short, sharp and exactly I was looked for. Thanks for a good job!


Title: Slight Modification
Name: Syarzhuk
Date: 4/19/2005 11:38:48 AM
Comment:
I rewrote it as: ^([01][012]|0?[1-9])/([0-2]?[0-9]|[3][0-1])/([0-9]{4})$ 1 - allow single digit month 2 - allow single digit year (so that 2/2/2005 matches) 3 - shorten the year expression Sincerely, Syarzhuk ([email protected])


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