I saw this question and this blog for regular PAN expression. [AZ]{5}[0-9]{4}[AZ]{1} . But my question is a little wider than that.
In the PAN card number:
1) The first three letters are sequence of alphabets from AAA to zzz 2) The fourth character informs about the type of holder of the Card. Each assesse is unique:` C β Company P β Person H β HUF(Hindu Undivided Family) F β Firm A β Association of Persons (AOP) T β AOP (Trust) B β Body of Individuals (BOI) L β Local Authority J β Artificial Judicial Person G β Government 3) The fifth character of the PAN is the first character (a) of the surname / last name of the person, in the case of a "Personal" PAN card, where the fourth character is "P" or (b) of the name of the Entity/ Trust/ Society/ Organisation in the case of Company/ HUF/ Firm/ AOP/ BOI/ Local Authority/ Artificial Jurdical Person/ Govt, where the fourth character is "C","H","F","A","T","B","L","J","G". 4) The last character is a alphabetic check digit.
I want the regex to be checked based on this. Since I get the name of the person or organization in another EditText, I needed to additionally check the 4th and 5th letter.
It turns out [AZ]{3}[C,H,F,A,T,B,L,J,G,P]{1}**something for the fifth character**[0-9]{4}[AZ]{1}
I canβt understand how this something should be written.
Programmatically, this can be done, someone did it in rails , but can this be done using regular expressions? How?
android regex
inquisitive
source share