How to validate GST number using Regular Expression in jQuery

This following example shows, how to validate GST number using RegExp in jQuery on a text change event.

GSTIN Number Format :

GSTIN number validation
<!DOCTYPE html>
 <script src=""></script>
 Enter GST Number : <input type="text" class="gst" >  
$(document).ready(function () {      
 $(".gst").change(function () {    
  var inputtext = $(this).val();    
  var gstinformat = new RegExp('^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9]{1}Z[a-zA-Z0-9]{1}$'); 
  if (gstinformat.test(inputtext)) {    
   alert("GSTIN Number Format is Verified");
  else {    
   alert('Please Enter Valid GSTIN Number');    
Try it Yourself