DD/MM/YYYY
Matches dates written with slashes.
Suggested pattern
^\d{2}\/\d{2}\/\d{4}$
What it matches
31/12/202501/01/2026
Common limitations
- Does not validate real calendar dates.
- 31/99/2025 still matches.
Visual regex workbench
Build, import, explain, test and share regex visually.
Regex guide
Date validation is one of the most common regex use cases. This guide provides practical date regex examples covering European formats, ISO standards and timestamps.
Matches dates written with slashes.
^\d{2}\/\d{2}\/\d{4}$
31/12/202501/01/2026Matches dates written with hyphens.
^\d{2}-\d{2}-\d{4}$
31-12-202501-01-2026Matches ISO 8601 dates.
^\d{4}-\d{2}-\d{2}$
2025-12-312026-01-01Matches UTC timestamps ending with Z.
^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$
2025-12-31T23:59:59ZValidates day and month ranges.
^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/\d{4}$
31/12/202501/01/2026Date regex patterns are commonly used to verify user input before processing, storing or converting dates.
They help ensure that values follow an expected format such as YYYY-MM-DD, DD/MM/YYYY or MM/DD/YYYY.
Different countries and applications use different date formats. ISO 8601 typically uses YYYY-MM-DD, while many European countries use DD/MM/YYYY.
Understanding the expected format is essential before creating a date validation regex.
ISO 8601 is one of the most widely used date formats in APIs, databases and software systems.
The YYYY-MM-DD format is easy to sort, compare and exchange between applications.
A regex can validate the structure of a date, but fully validating calendar rules is much more difficult.
For example, checking leap years, month lengths and historical calendar rules is usually better handled by dedicated date libraries.
Regex is excellent for checking whether a date looks correct, but parsing and interpreting dates should generally be handled by programming language date functions.
Combining regex validation with proper date parsing often provides the best results.
One common mistake is accepting impossible dates such as 2026-02-31 or 31/04/2026.
Another is mixing international date formats and creating ambiguity between month and day values.
Date regex patterns are useful in forms, imports, spreadsheets, APIs and data-cleaning workflows.
They provide a fast first layer of validation before more advanced business rules are applied.