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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^(((\d{4}((0[13578]|1[02])(0[1-9]|[12]\d|3[01])|(0[13456789]|1[012])(0[1-9]|[12]\d|30)|02(0[1-9]|1\d|2[0-8])))|((\d{2}[02468][048]|\d{2}[13579][26]))0229)){0,8}$
Description
Validates a date expression (or empty value) in CCYYMMDD format, checking a leap year from 00000101 A.D. to 99991231
Matches
20041231 | 20040229
Non-Matches
20043112 | 2003/04/02
Author Rating: Not yet rated. Danny Garber
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: Fails on 19000229
Name: Andy McDonald
Date: 9/16/2004 9:10:32 AM
Comment:
Only centuries divisible by 400 are leap years, e.g. 1900 was not a leap year, so 19000229 should not match this regexp; it does. One reference: http://www.cryst.bbk.ac.uk/CCSG/resources/Year2000/Leap_year_30Feb.html.


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