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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find day/month/year validate date
Expression
(?:\s|^)(?P<day>(?P<threeone>31)|(?P<thirty>30)|(?P<twonine>29)|(?P<twoeight>2[0-8]|1[0-9]|0?[1-9]))(?P<sep>[/\-\.:])(?P<month>(?(threeone)(?:1[02]|0?[13578]))(?(thirty)(?:1[012]|0?[13456789]))(?(twonine)(?:1[012]|0?[13-9]|(?P<leap>0?2)))(?(twoeight)(?:1[012]|0?[1-9])))(?P=sep)(?P<year>(?:\d\d)?(?(leap)(?:(?:[02468][048])|(?:[13579][26]))|(?:\d\d)))(?:$|\s)
Description
This matches valid dates (including leap year dates of the following formats : dd/mm/yy dd/mm/yyyy d/m/yy d/m/yyyy dd-mm-yy dd-mm-yyyy d-m-yy d-m-yyyy dd.mm.yy dd.mm.yyyy d.m.yy d.m.yyyy use the named groups day, month, year
Matches
29/02/2096
Non-Matches
29/02/2097, 31/04/2020
Author Rating: The rating for this expression. James Maguire
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

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