Skip to main content
CalcHive

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

TokenExplanation
^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

InputMatch?
03/15/2026Match
12/31/1999Match
13/01/2020No match
00/15/2020No match
3/5/2020No 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

Want to test this pattern with your own data?

Open the Regex Tester