大家好,欢迎来到IT知识分享网。
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′))
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/145276.html