Regex for Date (MM/DD/YYYY)
Matches dates in MM/DD/YYYY format with basic validation for month (01-12) and day (01-31) ranges.
Pattern
/^(0[1-9]|1[0-2])/(0[1-9]|[12]\d|3[01])/(19|20)\d{2}$/Pattern Breakdown
| Token | Explanation |
|---|---|
| ^ | Start of string |
| (0[1-9]|1[0-2]) | Month: 01-12 |
| / | Slash separator |
| (0[1-9]|[12]\d|3[01]) | Day: 01-31 |
| / | Slash separator |
| (19|20)\d{2} | Year: 1900-2099 |
| $ | End of string |
Test Examples
| Input | Match? |
|---|---|
| 03/15/2026 | Match |
| 12/31/1999 | Match |
| 13/01/2020 | No match |
| 00/15/2020 | No match |
| 3/5/2020 | No match |
Common Use Cases
- Date input validation
- Form field formatting
- Data import parsing
Variations
^\d{1,2}/\d{1,2}/\d{4}$Allows single-digit month and day
^(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])-(19|20)\d{2}$Uses dashes instead of slashes
Other Regex Patterns
Want to test this pattern with your own data?
Open the Regex Tester