Regex Time

Hi Experts,

I have regex to validate time HH:MM tt so I need to make sure I get

from 00:01 am to 11:59 pm

The problem is that this one I have does not take 01:01 am for example or 02:00 pm

so the leading zero makes it invalid time which is not true.

^ *(1[0-2]|[1-9]):[0-5][0-9] *(a|p|A|P)(m|M) *$

Thanks.
LVL 1
fpoyavoAsked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
^ *(1[0-2]|0[0-9]):[0-5][0-9] *[aApP][mM] *$
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.