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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^(([0-9])|([0-1][0-9])|([2][0-3])):(([0-9])|([0-5][0-9]))$
Description
reg. expr. 4 checking 24 time
Matches
1:59 | 01:59 | 23:59
Non-Matches
12:63 | 25:60 | 13.10
Author Rating: Not yet rated. Tomas Andrysek
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: same but to force 4 digits (ex. match only 01:59, and not 1:59)
Name: mlarcelet
Date: 7/26/2012 7:14:49 AM
Comment:
^([0-1][0-9]|[2][0-3]):[0-5][0-9]$


Title: Does not work with 00:05
Name: Alex
Date: 7/9/2012 7:42:44 AM
Comment:
Does not work for me with 00:05


Title: 13.10 is NOT correct. Notice the dot vs colon
Name: Ken
Date: 6/12/2012 5:16:03 PM
Comment:
easily missed


Title: Incorrect non matches
Name: Paul
Date: 2/25/2012 5:42:49 PM
Comment:
Non-Matches 12:63 | 25:60 | 13.10 I think this is incorrect as 13:10 is a valid time.


Title: Thanks a lot
Name: Purvesh
Date: 11/17/2011 3:59:36 AM
Comment:
It's the exactly what I was looking for.


Title: Too much info
Name: Eduard
Date: 3/14/2007 8:55:45 AM
Comment:
Using ^([0-1]?[0-9]|[2][0-3]):([0-5][0-9])$ would mean exactly the same, but your regexp is much shorter..


Title: Thanks Tomas
Name: alanl
Date: 1/13/2005 5:00:30 PM
Comment:
Sometimes simple things seem difficult. Regular expressions fall into that catagory for me. Thanks for your post Tomas, made this simple thing simple!


Title: Alexander
Name: Vinnitsky
Date: 12/22/2004 9:13:42 AM
Comment:
It useful for me thx.


Title: Perfect!
Name: Jimi
Date: 6/24/2004 12:49:37 PM
Comment:
Works exactly as I had imagined it should! I just couldn't write it myself! Thanks


Title: Its good
Name: smitha
Date: 11/11/2003 3:27:27 AM
Comment:
Its good.Its exactly what i wanted


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