Try this regular expression:
^(?:[01]?[0-9]|2[0-3]):[0-5][0-9]$
Or to be more distinct:
^(?:0?[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$
More Related Contents:
- RegEx to remove single quote, parentheses or square bracket from both beginning and end of a string [closed]
- How do I match an entire string with a regex?
- Find and extract a number from a string
- Regex.Match whole words
- Using RegEx to balance match parenthesis
- Regular expression to remove HTML tags
- Regular Expression to split on spaces unless in quotes
- Why does the order of alternatives matter in regex?
- What’s the difference between “groups” and “captures” in .NET regular expressions?
- Remove text in-between delimiters in a string (using a regex?)
- Need to perform Wildcard (*,?, etc) search on a string using Regex
- Why \b does not match word using .net regex
- Regular Expression for password validation
- RegEx for an IP Address
- Regex that matches a newline (\n) in C#
- Using WebClient in C# is there a way to get the URL of a site after being redirected?
- Translate Perl regular expressions to .NET
- Are Java and C# regular expressions compatible?
- C# – Regex for file paths e.g. C:\test\test.exe
- RegEx – reusing subexpressions
- Regex nested parentheses
- Ignoring white space for a Regex match
- Validating file types by regular expression
- How to make a regex match case insensitive?
- How to use inline modifiers in C# regex?
- Regex for Money
- Regular expression for 10 digit number without any special characters
- Regex for extracting certain part of a String
- regex to split line (csv file)
- is there a elegant way to parse a word and add spaces before capital letters