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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 2
Title Test Details Date and Hour with yyyy-MM-dd HH:mm format
Expression
((20)[0-9]{2})-((0[1-9])|(1[0-2]))-((3[0-1])|([0-2][1-9]|([1-2][0-9])))\s((2[0-3])|[0-1][0-9]):[0-5][0-9]
Description
Date and hour with fixed format, only accepting year >= 2000. If you want more flexibility on the year, you could replace the first expression (20)[0-9]{2} with only [0-9]{4}, that would allow years from 0000 to 9999.
Matches
2000-12-29 10:00 2014-10-20 23:59 2001-01-01 00:00
Non-Matches
1999-12-29 09:00 2014-01-02 9:00 2000-1-1 23:10
Author Rating: Not yet rated. Marcelo Teixeira de Melo Filho
   Displaying page 1 of 1 pages; Items 1 to 2

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