Skip to main content
Nintex Community Menu Bar

Time regular expression

  • March 14, 2019
  • 2 replies
  • 11 views

AndrewRobinson
Forum|alt.badge.img+2

Good evening,

 

I single line of text field that I'm using for users to enter in a time. I'm validating the field using this regular expression: ^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$

 

It works fine for putting in a time of, for example, 1:30 however I am wondering if there is a way to allow the user (or better yet force the user) to add AM or PM after the time.

 

All help is appreciated.

Andrew

2 replies

Forum|alt.badge.img+14
  • Scholar
  • March 14, 2019

sure, something like this shouldw work

 

^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]s(AM|PM)$

 

                  

 

 

 


AndrewRobinson
Forum|alt.badge.img+2

Thanks @emha. It works perfectly.