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?[1-9]|1[012])/(0?[1-9]|1\d|2[0-8])|(0?[13456789]|1[012])/(29|30)|(0?[13578]|1[02])/31)/(19|[2-9]\d)\d{2}|0?2/29/((19|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00)))$
Description
MM/dd/yyyy with 100% leap years. Valid since year 1900. MM and DD could have 1 or 2 digits : M/d/yyyy or MM/d/yyyy or M/dd/yyyy This was a request from a user in http://www.regexlib.com/REDetails.aspx?regexp_id=1038
Matches
01/31/1905 | 1/9/1900 | 2/29/1904
Non-Matches
31/01/2005 | 02/29/2005 | 2/29/2005
Author Rating: The rating for this expression. Dany Lauener
Source Dany Lauener http://www.regexlib.com/REDetails.aspx?regexp_id=1038
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: 2 digit DD and MM format
Name: Kevin P.
Date: 9/30/2017 3:33:57 PM
Comment:
Need help with regex where DD and MM must be 2 digits, for example: January 2nd must be "01/02" not "1/2". Thank you!


Title: asp.net implementation
Name: Matt
Date: 4/20/2015 9:08:43 PM
Comment:
How can this be implemented in asp.net? I'm using Microsoft Visual Studio and it doesn't like it for some reason.


Title: asp.net implementation
Name: Matt
Date: 4/20/2015 8:57:24 PM
Comment:
How can this be implemented in asp.net? I'm using Microsoft Visual Studio and it doesn't like it for some reason.


Title: asp.net implementation
Name: Matt
Date: 4/20/2015 8:57:12 PM
Comment:
How can this be implemented in asp.net? I'm using Microsoft Visual Studio and it doesn't like it for some reason.


Title: Outstanding for my needs!
Name: John Hunt
Date: 2/20/2015 1:09:46 PM
Comment:
Works great--so far.


Title: Regex: from 1/1/1000 to 12/31/9999 and supports mm/dd/yyyy, m/d/yyyy
Name: SaranRegex
Date: 3/4/2013 3:26:42 PM
Comment:
Regex: from 1/1/1000 to 12/31/9999 and supports mm/dd/yyyy, m/d/yyyy, mm/d/yyyy, m/dd/yyyy. ^((0?[13578]|1[02])[\/.]31[\/.][1-9][0-9]{3})|(([01,1]|0[3-9]|1[1-2])[\/.](29|30)[\/.][1-9][0-9]{3})|((0?[1-9]|1[0-2])[\/.](0?[1-9]|1[0-9]|2[0-8])[\/.][1-9][0-9]{3})|([02,2][\/.]29[\/.](([1-9][0-9](04|08|[2468][048]|[13579][26]))|([2468][0]{3})))$


Title: How can i use this in javascript?
Name: sahil
Date: 5/25/2012 4:28:09 AM
Comment:
Please tell/provide me how can i use this in javascript,if i use this in <asp:regularExpression> it works fine, but i want it use in javascript/jquery then it give syntax error please provide me.


Title: How can i use this in javascript?
Name: sahil
Date: 5/25/2012 4:27:54 AM
Comment:
Please tell/provide me how can i use this in javascript,if i use this in <asp:regularExpression> it works fine, but i want it use in javascript/jquery then it give syntax error please provide me.


Title: How can I limit this in years?
Name: Joel
Date: 5/31/2011 4:34:03 PM
Comment:
Is there a way I can limit this in years? Say for example, can I keep it the same but just limit it to 2011-2014? Thanks. - Joel


Title: How can I limit this in years?
Name: Joel
Date: 5/31/2011 4:30:38 PM
Comment:
Is there a way I can limit this in years? Say for example, can I keep it the same but just limit it to 2011-2014? Thanks. - Joel


Title: How can I limit this in years?
Name: Joel
Date: 5/31/2011 4:29:16 PM
Comment:
Is there a way I can limit this in years? Say for example, can I keep it the same but just limit it to 2011-2014? Thanks. - Joel


Title: Excellent just what I needed
Name: Kolt
Date: 3/9/2007 2:40:05 PM
Comment:
Thanks a LOT for this. Saves me a TON of time. I dunno what that dude's talking about, but I know I'm very grateful.


Title: Wrong debate :) I use a battle axe to put butter on my bread
Name: Dany Lauener
Date: 5/2/2005 2:52:04 AM
Comment:
This is your personal point of view. Mine is : better check twice ! Of course, as with a "password" check, you'll implement some code behind to prevent SQL hack or so on. But when you have bloody users that ask for a validation summary, then it just cost nothing to implement a small regexp :) And regexp are just so simple.... Cheers Dany


Title: Wrong thing to be doing in a regex
Name: Randal L. Schwartz
Date: 4/28/2005 8:48:27 PM
Comment:
This is really the wrong thing to be doing in a regex. It's like cutting bread with a chainsaw. Why is there so much silliness abounding like this?


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