Regex for ISO date (YYYY-MM-DD)

Matches an ISO 8601 calendar date like 2026-07-13.

^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$

Proof it works

5/5 sample tests passed · compiles: true

SampleShould matchResult
2026-07-13 yes pass
1999-12-31 yes pass
2026-13-01 no pass
2026-7-3 no pass
07/13/2026 no pass

Try your own input

Related patterns