regex for pan from gstin

extracts PAN number from a valid GSTIN number

^([0][1-9]|[1-2][0-9]|[3][0-5])([a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1})([1-9a-zA-Z]{1}[zZ]{1}[0-9a-zA-Z]{1})+$
22ABCDE1234F1Z5 11GHIJK1234L1Z5 33PQRST5678L1Z5 34UVWXY5678L1Z5 35PQRST5678L1Z5 22ABCDE1234F1Z5

A PAN is a unique identifier issued to all judicial entities identifiable under the Indian Income Tax Act, 1961

This regex matches PAN number from GSTIN number for validation of PAN number embedded in GSTIN

A permanent account number (PAN) is a ten-character alphanumeric identifier, issued in the form of a laminated "PAN card", by the Indian Income Tax Department. This regex can extract the match number from a Goods and Services Taxpayer Identification Number (GSTIN).


Cheatsheet

expr usage
/\w/ matches any word character (a-z, A-Z, 0-9, _)
/[a-z]/ matches all lowercase letters (a to z)
/[0-9]/ matches all digits
/[a-zA-Z0-9]/ matches all lowercase, uppercase letters and numbers
/(hello){1,3}/ matches "hello" that occur between 1 and 3 times (inclusive)
iHateRegex
by geon