A regular expression to match a 12-hour time with AM/PM after it.
/^ *(1[0-2]|[1-9]):[0-5][0-9] *(a|p|A|P)(m|M) *$/
Matches:
- 1:00 PM
- 1:00 pm
- 12:59am
Non-matches:
- 13:00 PM
- 1:00
- 12:59
See Also:
- Date (dd/mm/yyyy) Regular Expression
- 24-Hour Time (HH:mm:ss) Regular Expression
- Regular Expression For Year
- 12-Hour Time (hh:mm:ss) Regular Expression