This will be quick and dirty. I was looking for a regex that handles checking an input time in this kind of format: hh:mm(am or pm). So I wanted to accept the following:
06:00am 6:00am 12:00pm
But not accept:
6:00 14:00 6;00pm 6:00pmpm
You’d be surprised how many people type in pm or am twice. I managed to find a Regex that works thanks to Stackoverflow. Of course I don’t know where the link is. If I find it again, I’ll link it. Here’s the Regex:
/^(0?[1-9]|1[012])(:[0-5]\d)[APap][mM]$/