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)(?:(?!(?:1582(?:\.|-|\/)10(?:\.|-|\/)(?:0?[5-9]|1[0-4]))|(?:1752(?:\.|-|\/)0?9(?:\.|-|\/)(?:0?[3-9]|1[0-3])))(?=(?:(?!000[04]|(?:(?:1[^0-6]|[2468][^048]|[3579][^26])00))(?:(?:\d\d)(?:[02468][048]|[13579][26]))\D0?2\D29)|(?:\d{4}\D(?!(?:0?[2469]|11)\D31)(?!0?2(?:\.|-|\/)(?:29|30))))(\d{4})([-\/.])(0?\d|1[012])\2((?!00)[012]?\d|3[01])(?:$|(?=\x20\d)\x20))?((?:(?:0?[1-9]|1[012])(?::[0-5]\d){0,2}(?:\x20[aApP][mM]))|(?:[01]\d|2[0-3])(?::[0-5]\d){1,2})?$
Description
yyyy/mm/dd hh:MM:ss Datetime for all AD years, including leap years. Javascript safe version of http://regexlib.com/REDetails.aspx?regexp_id=760. Please see that regex for details of what is being checked
Matches
0008-02-29 | 2:34:59 PM | 9999/12/31 11:59 PM
Non-Matches
04/04/04 | 1:00 | 1999/1/32
Author Rating: The rating for this expression. Michael Ash
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: Pattren Title
Name: Web Lady
Date: 3/23/2017 8:57:04 PM
Comment:
please add a pattern title Something like DateTime inc. Leap years


Title: Not JavaScript Safe
Name: J Minnihan
Date: 10/14/2016 3:33:45 PM
Comment:
Use within a JavaScript module returns the following error: Uncaught Syntax Error: Octal literals are not allowed in strict mode."


Title: Re: Client-side Regex Engines
Name: Michael Ash
Date: 9/17/2004 2:46:09 PM
Comment:
Actually it does work. The Client-side test for this site doesn't seem to be working at the moment for certian browsers (non IE). Try it with this test tool http://www.unusualresearch.com/regex/toolrei.htm


Title: Client-side Regex Engines
Name: Artur Almeida
Date: 9/17/2004 2:14:31 PM
Comment:
this expression does not work properly with Client-side Regex Engines. For example: 2004-02-29 does not match


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