GST标识号(GSTIN)的正则表达式 [英] Regex for GST Identification Number (GSTIN)
本文介绍了GST标识号(GSTIN)的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
印度GST号码的正则表达是什么?您可以从
格式详情
- 商品及服务税编号的前2位数字代表按人口普查(2011年)编制的国家代码。
- 接下来的10位数字与纳税人的PAN编号相同。
- 前五个将是字母
- 接下来的四个将是数字
- 最后一个是支票代码
- 第13位数字是你在一个州内注册的数量,即在9之后,A到Z是被视为10至35。
- 默认情况下,第14位数字为Z.
- 最后一位是支票代码。
以下是使用js中的校验和验证/验证gstin编号的代码
function checksum(g){let a = 65,b = 55,C = 36; return Array ['from'](g).reduce((i,j,k,g)=> {p =(p =(j.charCodeAt(0)< a?parseInt(j):j.charCodeAt (0)-b)*(k%2 + 1))> c?1+(pc):p;返回k <14?i + p:j ==((c =(c-(i%c) )))< 10?c:String.fromCharCode(c + b));},0); }的console.log(校验和( '27AAPFU0939F1ZV'))的console.log(校验和( '27AASCS2460H1Z0'))的console.log(校验和( '29AAGCB7383J1Z4'))
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)<a?parseInt(j):j.charCodeAt(0)-b)*(k%2+1))>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'))
GST regex and checksum in various programming languages
这篇关于GST标识号(GSTIN)的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文