Tech
How GSTIN Checksum Validation Works (and Why It Isn't Enough)
Every Indian GST invoice carries a 15-character GSTIN. If you've ever had to validate one in code, you've probably written a regex like this and called it done:
/^ [ 0 - 9 ]{ 2 }[ A - Z ]{ 5 }[ 0 - 9 ]{ 4 }[ A - Z ]{ 1 }[ 1 - 9 A - Z ]{ 1 } Z [ 0 - 9 A - Z ]{ 1 } $ /
That regex checks the shape of a GSTIN. It says nothing about whether the number is real. A typo that happens to land on a syntactically valid string will sail str...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to