sql server - Regex for hh:mm:ss tt string -


i've looked @ few regex time questions haven't found 1 need , i'm pretty clueless on how write regex expressions.

i need time values pass:

  • 06:03:05 am
  • 06:03 pm
  • 6:3:5 am

this regex seems it'd work this(which found on here need have am/pm part required can case insensitive.

([0-1]?\d|2[0-3]):([0-5]?\d):([0-5]?\d) 

so sum need in regex:

  • single digit h:m:s acceptable
  • double digit hh:mm:ss acceptable
  • am/pm required case insensitive
  • if am/pm part can entered or p nice, not needed
  • seconds optional
  • 24 hour time not acceptable

any appreciated.

the regex provide supports 24 hour time, following stringently follows request

(1[012]|0?\d):[0-5]?\d(:[0-5]?\d)?\s+[aapp][mm]? 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -