MediumValidation
24-Hour Time Validator
Write a regex that validates times in 24-hour HH:MM format, where hours must be 00-23 and minutes must be 00-59, with leading zeros required.
//
14:30 / 00:00 / 23:59 / 24:00 / 9:30 / 12:60
Test cases
- 14:30expect match
- 00:00expect match
- 23:59expect match
- 24:00expect no match
- 9:30expect no match
- 12:60expect no match
How to Solve this Regex Challenge
To complete the 24-Hour Time Validator challenge, you must write a regular expression pattern that satisfies all specified test cases.
Steps to Complete:
- Analyze the Requirements: Read the description and review the list of test cases below. Identify which strings must be matched (green markers) and which must be rejected (red markers).
- Draft Your Pattern: Enter your regex in the interactive editor. Use the provided Hint button if you get stuck.
- Verify: The test cases panel will update in real-time as you type, showing which strings match your current expression.
- Review the Solution: Once you successfully pass all test cases, review the explanation to understand the logic behind the solution.