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 Pattern Title
Expression
^(((((0[1-9])|(1\d)|(2[0-8]))[/.-]((0[1-9])|(1[0-2])))|((31[/.-]((0[13578])|(1[02])))|((29|30)[/.-]((0[1,3-9])|(1[0-2])))))[/.-]((000[^0])&([0-9][0-9][0-9][0-9]))|(29[/.-]02[/.-](([0-9][0-9](([02468][48])|([2468][048])|([13579][26])))|((([02468][48])|([2468][048])|([13579][26]))00))))$
Description
Checks 0001-9999 Along with leap years intermediate symbols can be / or . or - this can be modified easily
Matches
29-02/0004 | 29/02/0004 | 29.02.9996
Non-Matches
29-2-0004 | 29/02/0005 | 29.02.0000
Author Rating: The rating for this expression. Isha
Title Test Details Pattern Title
Expression
^(((((0[1-9])|(1\d)|(2[0-8]))/((0[1-9])|(1[0-2])))|((31/((0 [13578])|(1[02])))|((29|30)/((0[1,3-9])|(1[0-2])))))/((000 [1-9])|(00[1-9][0-9])|(0[1-9][0-9][0-9])|([1-9][0-9][0-9] [0-9]))|(29/02/(([0-9][0-9](([02468][48])|([2468][048])| ([13579][26])))|((([02468][48])|([2468][048])|([13579] [26]))00))))$
Description
Checks for years 0001-9999. Checks leap year corectly (0004,0400,0040) Can use / as separators or can replace it. Easy to understand and can be modified easily for mm/dd/yyyy or yyyy/dd/mm or mm-dd-yy or to any date format.
Matches
29/02/0400 | 01/01/0001 | 31/12/9999
Non-Matches
29/2/0400 | 1/01/0001 | 29/02/5555
Author Rating: The rating for this expression. Isha
   Displaying page 1 of 1 pages; Items 1 to 2

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