MediumValidation
ISO Date Format Checker
Write a regex that checks whether a string follows the YYYY-MM-DD digit layout (four digits, dash, two digits, dash, two digits). It only needs to check the shape, not whether the date is a real calendar date.
//
2026-07-10 / 2026-7-10 / 07-10-2026 / 2026/07/10 / 9999-99-99
Test cases
- 2026-07-10expect match
- 2026-7-10expect no match
- 07-10-2026expect no match
- 2026/07/10expect no match
- 9999-99-99expect match
- abcd-ef-ghexpect no match
How to Solve this Regex Challenge
To complete the ISO Date Format Checker 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.