Regular Expression To Validate Credit Card Expiration Date

A Regular Expression to match and validate Credit Card Expiration Date in MM/YY format.

/^(0[1-9]|1[0-2])\/?([0-9]{4}|[0-9]{2})$/

Matches:

  • 02/22
  • 01/25
  • 12/26

Non-matches:

  • 02/203
  • 10/03
  • 10/2022

See Also: