GSTIN syntax Validation in Jquery

0
133
Jquery

This example explains how to validate Indian GSTIN syntax in html page using jquery.

var gstin= $('#gstin').val();
var reg = '/^(0[1-9]|[1-2][0-9]|3[0-9])([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}([a-zA-Z0-9]){1}([a-zA-Z]){1}([a-zA-Z0-9]){1}?$/';

if(reg.test(gstin)){
   console.log('Valid');
} else {
console.log('invalid GSTIN');
}

LEAVE A REPLY

Please enter your comment!
Please enter your name here