Skip to content

Instantly share code, notes, and snippets.

@dezinezync
Last active August 16, 2018 09:36
Show Gist options
  • Save dezinezync/934d8d73502058f617ba1dbd280daf95 to your computer and use it in GitHub Desktop.
Save dezinezync/934d8d73502058f617ba1dbd280daf95 to your computer and use it in GitHub Desktop.
[RegExp] GST Number Validation
/^
(0[0-9]|1[1-9]|2[0-9]|3[0-7]) // matches the first two digits. This needs to be within the 01-37 range
[A-Z]{3} // first three letters of the PAN Card
[CPHFATBLJG]{1} // PAN limited set control character
[A-Z]{1} // PAN non-limited set control character
\d{4} // PAN Identity numbers
[A-Z]{1} // PAN non-limited set control character
\d{1} // GST control number
[A-Z0-9]{2} // GST non-limited control characters
$/g
// one-liner
/(0[0-9]|1[1-9]|2[0-9]|3[0-7])[A-Z]{3}[CPHFATBLJG]{1}[A-Z]{1}\d{4}[A-Z]{1}\d{1}[A-Z0-9]{2}/g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment