The GST number is a 15-digit number, which is unique for each taxpayer.
- The first two digits represent the state code. Each state in India is assigned a unique state code.
- The next ten digits of the GST number contain the PAN of the taxpayer.
- The next two digits of the GST number represent the entity code. It represents the number of registrations that were made by a business entity within a state.
- The last digit serves as a check code. It is used to detect errors.
regex = "^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$";
Where:
- ^ represents the starting of the string.
- [0-9]{2} represents the first two characters should be a number.
- [A-Z]{5} represents the next five characters should be any upper case alphabets.
- [0-9]{4} represents the next four characters should be any number.
- [A-Z]{1} represents the next character should be any upper case alphabet.
- [1-9A-Z]{1} represents the 13th character should be a number from 1-9 or an alphabet.
- Z represents the 14th character should be Z.
- [0-9A-Z]{1} represents the 15th character should be an alphabet or a number.