ISO 8601 Date
beginnerMatches dates in YYYY-MM-DD format following ISO 8601.
dateisoformatvalidation
Pattern
/\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])/gTry It
0 of 7 strings matched
Explanation
Matches 4-digit year, followed by month (01-12) and day (01-31) separated by hyphens. Does not validate month-day combinations (e.g., Feb 31 passes).
Test Strings
Matching
- 2024-01-15
- 2023-12-31
- 1999-06-30
Non-matching
- 2024-13-01
- 2024-00-15
- 24-01-15
- 2024/01/15
Language Compatibility
| Language | Support |
|---|---|
| JS | Full support |
| PYTHON | Full support |
| JAVA | Full support |
| PHP | Full support |
| GO | Full support |
Code Snippets
const regex = /\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])/g;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);Common Variations
With slashes
\d{4}/(?:0[1-9]|1[0-2])/(?:0[1-9]|[12]\d|3[01])YYYY/MM/DD format