Title |
Test
Find
Pattern Title
|
Expression |
^\d{4}[\-\/\s]?((((0[13578])|(1[02]))[\-\/\s]?(([0-2][0-9])|(3[01])))|(((0[469])|(11))[\-\/\s]?(([0-2][0-9])|(30)))|(02[\-\/\s]?[0-2][0-9]))$ |
Description |
- validates a yyyy-mm-dd, yyyy mm dd, or yyyy/mm/dd date
- makes sure day is within valid range for the month
- does NOT validate Feb. 29 on a leap year, only that Feb. CAN have 29 days |
Matches |
0001-12-31 | 9999 09 30 | 2002/03/03 |
Non-Matches |
0001\02\30 | 9999.15.01 | 2002/3/3 |
Author |
Rating:
Rex Po
|
Source |
|
Your Rating |
|
Title: Nice RegEx!
Name: Ed Z
Date: 1/9/2008 8:28:49 AM
Comment:
This is the best date RegEx I could find. It is easy to rewrite it to support other date formats. Good job!
Title: Nice RegEx!
Name: Ed Z
Date: 1/9/2008 8:28:40 AM
Comment:
This is the best date RegEx I could find. It is easy to rewrite it to support other date formats. Good job!