Regexp Help

Associate
Joined
18 Oct 2002
Posts
1,581
Location
Nottingham
using a regular expression in javascript i want it to validate a string with two capital letters at the start then 7 digits e.g. AA1234567

At the moment i have [A-Z][A-Z][0-9]{7} but this gives a match if you input more than 7 digits. How do i tell it to only give a match if it is two capitals and 7 digits exactly?

IGNORE ME

sorry wasted a thread, please delete. I figured it out by using

/^[A-Z]{2}\d{5,}$/

This allows digits of 5 or more and no characters after the digits
 
Last edited:
Back
Top Bottom