Regular Expressions For 4 Or 6 Digits

Regular Expressions that exactly match 4 or 6 digits, which are typically used in Pin Code.

4 Digits Regex:

/^[0-9]{4}$/

6 Digits Regex:

/^[0-9]{6}$/

See Also: