Regular Expressions 101

Community Patterns

PAN Card Regex

0

Regular Expression
PCRE (PHP <7.3)

/
^[a-zA-Z]{3}[p|P|c|C|h|H|f|F|a|A|t|T|b|B|l|L|j|J|g|G][A-Za-z][\d]{4}[A-Za-z]$
/
gm

Description

The PAN code is a ten-character long alpha-numeric unique identifier

A typical PAN is AFZPK7190K. The combination in which alphabet and numbers are arranged is explained further.

The first three characters (AFZ in the above PAN) are alphabetic series running from AAA to ZZZ. The fourth character of the PAN (P in the above PAN) represents the status of the PAN holder. "P" means an individual, "F" stands for firm, "C" stands for company, "H" stands for HUF, "A" stands for AOP, "T" stands for trust etc. The fifth character (K in the above PAN) is the first character of the holder's last name/surname. The next four characters (7190 in the above PAN) are sequential number running from 0001 to 9999. The last character (K in the above PAN) is an alphabetic check digit.

Regex : ^[a-zA-Z]{3}[p|P|c|C|h|H|f|F|a|A|t|T|b|B|l|L|j|J|g|G][A-Za-z][\d]{4}[A-Za-z]$

Submitted by anonymous - 5 years ago