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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^([2-9]\d{3}((0[1-9]|1[012])(0[1-9]|1\d|2[0-8])|(0[13456789]|1[012])(29|30)|(0[13578]|1[02])31)|(([2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00))0229)$
Description
yyyyMMdd with leap year validation, starting from year 2000 only. The length of the expression is minimized, but still validates all entries. If you want it with years like 1600 or separators, just ask :)
Matches
20000101 | 20051231 | 20040229
Non-Matches
19990101 | 20053112 | 20050229
Author Rating: The rating for this expression. Dany Lauener
Source Dany Lauener
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: help please
Name: Stan Radu
Date: 9/10/2017 3:33:47 PM
Comment:
need exact validation as this but for birthdays, can you do one that can work with pre year 2000, please?


Title: 2999 expression
Name: 2999 expression
Date: 8/9/2017 1:19:38 PM
Comment:
2999:)


Title: year 1600 and "-" separator
Name: Soumik Dasgupta
Date: 6/29/2012 2:41:38 AM
Comment:
Need the expression to work from year 1600 and also with optional separator "-". Highly appreciate your help


Title: With separators
Name: Dan
Date: 9/30/2011 10:24:54 AM
Comment:
Thanks for your help. Changed your expression to use separator and then it worked fine for me ^([2-9]\d{3}-((0[1-9]|1[012])-(0[1-9]|1\d|2[0-8])|(0[13456789]|1[012])-(29|30)|(0[13578]|1[02])-31)|(([2-9]\d)(0[48]|[2468][048]|[13579][26])|(([2468][048]|[3579][26])00))-02-29)$


Title: Help
Name: Angad
Date: 3/29/2011 2:11:05 AM
Comment:
I am looking for regex of the format mmddyyyy can you help me with this ?


Title: search-ebook.com
Name: Olya
Date: 7/24/2009 9:13:45 AM
Comment:
Find the files you are looking for at search-ebook.com the most comprehensive source for free-to-try files downloads on the Web


Title: Great
Name: Venkatesh
Date: 11/12/2007 2:04:31 PM
Comment:
Excellet Work it really works well


Title: Does Not Match 08/23/2007
Name: iamtgo3
Date: 8/23/2007 11:58:50 AM
Comment:
I used this and it seems to work with sample data but it does not however work with 08/23/2007 is there a reason for this?


Title: Does Not Match 08/23/2007
Name: iamtgo3
Date: 8/23/2007 10:00:29 AM
Comment:
I used this and it seems to work with sample data but it does not however work with 08/23/2007 is there a reason for this?


Title: Optional components and separators
Name: Jon B
Date: 6/22/2007 8:35:10 PM
Comment:
Hi, this looks awesome, however I can't get it to do what I want which is to match: 2007/12/31/ ||| 2007/12/31 ||| 2007/12/ ||| 2007/12 ||| 2007/ ||| 2007 My reason is that I am looking to use it for 'clean urls' - so the separators are mandatory between components, but optional afterwards. I'm hoping you can help me out since you seem to have a great grasp of regex. If you'd prefer to email me then please use flotsam[at]scrwd[dot]com Thanks.


Title: Optional components and separators
Name: Jon B
Date: 6/22/2007 4:53:44 PM
Comment:
Hi, this looks awesome, however I can't get it to do what I want which is to match: 2007/12/31/ ||| 2007/12/31 ||| 2007/12/ ||| 2007/12 ||| 2007/ ||| 2007 My reason is that I am looking to use it for 'clean urls' - so the separators are mandatory between components, but optional afterwards. I'm hoping you can help me out since you seem to have a great grasp of regex. If you'd prefer to email me then please use flotsam[at]scrwd[dot]com Thanks.


Title: lakshmi p
Name: lakshmi narayana p
Date: 2/17/2006 11:15:18 AM
Comment:
it is very great and very helpful. could you please update me with yyyy/mm/dd format. my mail id is [email protected],[email protected]


Title: If you want it with years like 1600 or separators, just ask :)
Name: Tom Verkon
Date: 7/25/2005 11:31:52 AM
Comment:
What would this expression look like if I wanted to include years earlier than 2000?


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