Learner Learner - 3 years ago 153
Javascript Question

Javascript regular expression for vehicle number

Would someone write a regular expression to validate a vehicle number in text box with the below format:


i.e. Alphabets in 1st 2 characters, special character '-', then two numbers, special character '-', then two alphabets, special character '-' and then 4 digit number.

Answer Source

This a very simple tasks. Try this:

  • The [A-Z] means the capital alphabet characters.
  • The \d means digits.
  • The numbers between curved brackets {..} means how many times the preceding should be repeated.
  • The ^ means the beginning of the string and the $ means the end of it.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download