What is the regex for the GST number in India. You can read more about the GST numbers from https://cleartax.in/s/know-your-gstin
On a summary level the number is represented as
List itemThe first two digits of this number will represent the state code as per Indian Census 2011
The next ten digits will be the PAN number of the taxpayer
The thirteenth digit will be assigned based on the number of registration within a state
The fourteenth digit will be Z by default
The last digit will be for check code
解决方案
Here is the regex and checksum validation for GSTIN
\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}
Format details
First 2 digits of the GST Number will represent State Code as per the Census (2011).
Next 10 digits will be same as in the PAN number of the taxpayer.
First five will be alphabets
Next four will be numbers
Last will be check code
The 13th digit will be the number of registration you take within a state i.e. after 9, A to Z is considered as 10 to 35 .
14th digit will be Z by default.
Last would be the check code.
Here is the code for verifying/validating the gstin number using the checksum in js
function checksum(g){
let a=65,b=55,c=36;
return Array['from'](g).reduce((i,j,k,g)=>{
p=(p=(j.charCodeAt(0)c?1+(p-c):p;
return k<14?i+p:j==((c=(c-(i%c)))<10?c:String.fromCharCode(c+b));
},0);
}
console.log(checksum('27AAPFU0939F1ZV'))
console.log(checksum('27AASCS2460H1Z0'))
console.log(checksum('29AAGCB7383J1Z4'))