Title |
Test
Find
12-Hour Time (HH:MM:SS)
|
Expression |
^(0?[1-9]|1[0-2])(\:)([0-5][0-9])(\:)([0-5][0-9]) (AM|PM)$ |
Description |
This regex validates time strings to ensure they're in the format HH:MM:SS. It accepts from 1:00:00-12:59:59 |
Matches |
12:13:10 AM, 01:42:59 PM, 1:36:22 PM |
Non-Matches |
13:19:41, 2:52, 3:19 PM |
Author |
Rating:
Not yet rated.
Nathon Dalton
|
Source |
|
Your Rating |
|
Title: metacharacter '?'
Name: omordha
Date: 12/5/2013 10:55:29 AM
Comment:
I answered my own question. I'm using the format xx:xx:xx, so it works fine without the '?'. Your expression will accept x:xx:xx, which needs the '?' to work.
Title: metacharacter '?'
Name: omordha
Date: 12/5/2013 10:48:58 AM
Comment:
What does the '?' do to this expression? I removed it and it tested fine.
Title: metacharacter '?'
Name: omordha
Date: 12/5/2013 10:47:11 AM
Comment:
What does the '?' do to this expression? I removed it and it tested fine.