Title |
Test
Find
Pattern Title
|
Expression |
^ *(1[0-2]|[1-9]):[0-5][0-9] *(a|p|A|P)(m|M) *$ |
Description |
validate 12-hour time with am/pm after it, with optional spaces before or after, and optionally between time and am/pm. |
Matches |
12:00am | 1:00 PM | 12:59 pm |
Non-Matches |
0:00 | 0:01 am | 13:00 pm |
Author |
Rating:
Not yet rated.
Jim Tebbel
|
Source |
|
Your Rating |
|
Title: A liitle modification
Name: RapidMod.com
Date: 2/19/2015 8:50:53 PM
Comment:
I needed a little modification for my specific use but thank you
$pattern = "%(1[0-2]|[1-9]):[0-5][0-9] *(a|p|A|P)(m|M)%";
preg_match($pattern, trim($time),$data);