Regular Expressions 101

Community Patterns

1...56789...745

Month / Year Format (MM/YY)

1

Regular Expression
ECMAScript (JavaScript)

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

Description

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

/^(0[1-9]|1[0-2]) :

First Digit - 0 second digit will be -0 to 9 ----> for Jan to Sep First Digit - 1 second digit will be -0 to 2 ----> for Oct to Dec

/?([0-9]{2})$/

2 Digit in between 0 to 9.

Submitted by anonymous - 10 months ago