• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

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.
0
fpoyavo
Asked:
fpoyavo
1 Solution
 
ozoCommented:
^ *(1[0-2]|0[0-9]):[0-5][0-9] *[aApP][mM] *$
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now