1 Reply Latest reply on Nov 14, 2007 12:32 PM by Virus_Hunter

    Regular Expression help

    JKohn99 Level 1
      If there are any RegExp gurus out there I'm looking for some help. I'm trying to validate
      a time string that will be in 12 hour format. 01:30 PM 12:15 AM etc. I have an expression that works
      when I type in a 2 digit hour. However I want the user to be able to also
      enter 1:30 PM instead of 01:30 PM and still have that pass as valid. I also want to flag as an error
      16:30 PM .

      the following expression works for the 2 digit hour
      /(0[1-9]|1[0-2]|2[4-5]):[0-5][0-9]\s+([ap]m|[AP]M)/

      Any help on allowing a allowing a single digit hour (without also allowing hours > 13 would be
      appreciated.

      Thanks