Regular Expression To EU Date Format (DD-MM-YYYY)

A regular expression to match an EU date format: DD-MM-YYYY.

/^(((((0[1-9])|(1\d)|(2[0-8]))-((0[1-9])|(1[0-2])))|((31-((0[13578])|(1[02])))|((29|30)-((0[1,3-9])|(1[0-2])))))-((20[0-9][0-9]))|(29-02-20(([02468][048])|([13579][26]))))$/

Matches:

  • 20-12-2021
  • 01-01-2022
  • 31-12-1980

Non-matches:

  • 12-20-2021
  • 1-1-2022
  • 12-31-1980

See Also: