I want to validate UZB passport number and therefore I need regex.
So my requirements is that, string must contain exactly 2letters (not case-sensitive) followed by 6 or 7 numbers (not less, not more).
Examples:
- Should pass: AB1234567 or aB123456
- Shouldn’t pass: ABC123456, AB12345678 or A12345678
I tried
/[a-zA-Z]{2}[0-9]{7}$/
but it didn’t help.
Thanks in advance
>Solution :
Solution below:
^[A-Za-z]{2}\d{6,7}$