Want a regex for validating Indian Vehicle Number Format?
Try this
^[A-Z]{2}\s[0-9]{2}\s[A-Z]{2}\s[0-9]{4}$
^
means start of string [A-Z]{2}
means 2 characters in the range of A through Z\s
means white space[0-9]{2}
means 2 characters in the range of 0 through 9\s
means white space[A-Z]{2}
means 2 characters in the range of A through Z\s
means white space[0-9]{4}
means 4 characters in the range of 0 through 9$
means end of string
Based on what you said in your question this should be a very broad check against proper format, but I have a feeling that there are more specific regulations on how the license plates are numbered. Let me know if there are additional constraints for the regex.
If you are looking for number plate(VRN) then use following regex
^[A-Z|a-z]{2}\s?[0-9]{1,2}\s?[A-Z|a-z]{0,3}\s?[0-9]{4}$
Based on the Wikipedia spec:
^[A-Z]{2}[ -][0-9]{1,2}(?: [A-Z])?(?: [A-Z]*)? [0-9]{4}$
- The first two letters of the registration plate represent the State in which the vehicle is Registered.
- The next two digit numbers are the sequential number of a district. Due to heavy volume of vehicle registration, the numbers were given to the RTO offices of registration as well.
- The third part is a 4 digit number unique to each plate. A letter(s) is prefixed when the 4 digit number runs out and then two letters and so on.
- In some states (such as the union territory of Delhi, and previously in Gujarat and Bihar ) the initial 0 of the district code is omitted; thus Delhi district 2 numbers appear as DL 2 not DL 02.
- The National Capital Territory of Delhi has an additional code in the registration code: DL 01 C AA 1111
Indian Vehicle number are like :
GJ 01 AA 1234 or KA 08 J 9192 or (New Bharat Series) like 22 BH 1234 AB or 22 BH 1234 A
You Can validate using these 2 regular expressions:
1) ^[A-Z]{2}[0-9]{2}[A-HJ-NP-Z]{1,2}[0-9]{4}$
2) ^[0-9]{2}BH[0-9]{4}[A-HJ-NP-Z]{1,2}$
As per RTO rules:
In RTO series Alphabet 'I' and 'O', 2 are excluded to avoid confusion with digits 0 or 1.