Title |
Test
Find
Pattern Title
|
Expression |
^(([0]?[1-9]|1[0-2])/([0-2]?[0-9]|3[0-1])/[1-2]\d{3})? ?((([0-1]?\d)|(2[0-3])):[0-5]\d)?(:[0-5]\d)? ?(AM|am|PM|pm)?$ |
Description |
Matches variations on date/time/AM-PM. Must have 4 digit year, but everything else is open. Restrictions are: 4 digit year, months 1-12, hours 1-23, minutes and seconds 1-59, any case of AM and PM. If this don't woik, I wrote it, lemmy know. |
Matches |
12/30/2002 | 12/30/2002 9:35 pm | 12/30/2002 19:35:02 |
Non-Matches |
18/22/2003 | 8/12/99 | 8/22/2003 25:00 |
Author |
Rating:
Not yet rated.
Michael Gaertner
|
Source |
Various addmixures of mgaert and the RegExLib.com posse. |
Your Rating |
|
Title: Ok Expression
Name: EdwardQ
Date: 12/9/2009 2:51:13 PM
Comment:
This expression also matches a space, and AM and PM And 12:05
Title: Excellent expression!
Name: D Mudge
Date: 7/21/2006 9:32:45 AM
Comment:
This is an excellent expression for validating basic date/time combinations. Thank you very much!