RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Time
Expression
^([0-1]?\d|2[0-3])([:]?[0-5]\d)?([:]?|[0-5]\d)?\s?(A|AM|P|p|a|PM|am|pm|pM|aM|Am|Pm)?$
Description
Its a very flexible time entry regular expression. It can accept all valid combination of time entry
Matches
1100 , 1100P,11:30A,11:30,11,11A,11:30AM
Non-Matches
11@,abc
Author Rating: Not yet rated. Amita
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Nearly perfect
Name: Saavik
Date: 8/16/2007 1:35:22 AM
Comment:
I am new to RegEx so I was happy to see your entry. Unfortunately, it accepted invalid time entries such as 23:00pm. Hope to see a fix soon - this is the closest I found to a really flexible time validation. Thanks.


Title: Time Check Vilidation code
Name: Mukul
Date: 8/11/2006 3:51:39 AM
Comment:
time format(hh:mm)


Title: m
Name: m
Date: 8/11/2006 3:50:18 AM
Comment:
time validation


Title: Title
Name: Gautam
Date: 8/8/2006 3:41:44 PM
Comment:
Pretty good.


Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials