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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Timespan
Expression
(\d+(?:\s+d(?:ay)?s?))?\s?(\d+(?:\s+h(?:ou)?r?s?))?\s?(\d+(?:\s+m(?:in)?(?:ute)?s?))?\s?(\d+(?:\s+s(?:ec)?(?:ond)?)?s?)?$
Description
Used for matching fuzzy timespans given in days, hours minutes, seconds and any combination thereof.
Matches
6 days 18 hrs 2 mins | 4 days 19 hrs 5 mins | 4 days 19 hrs 12 mins | 2 h 20 mins | 1 hr 20 mins | 1 hour | 12 m | 12 minutes 15 seconds | 12 mins 15 secs | 1 min | 1 mins 10 seconds | 1 min 35 secs | 1 m | 1 m 10 s | 1 m 35 secs | 24 seconds | 25 secs | 1 sec | 1 s | 1 secs
Non-Matches
7 apples 2 pears | 1 banana 2 banana | 3 banana 4 | 5 banana 6 banana 7 banana more
Author Rating: Not yet rated. HJennerway
Source My Grey Matter
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

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