Widziałem this question i this blog dla regex PAN. [A-Z]{5}[0-9]{4}[A-Z]{1}
. Ale moje pytanie jest nieco bardziej rozbudowane.Wyrażenie regularne sprawdzające numer karty PAN
W numeru karty PAN:
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.
chcę regex do sprawdzenia na podstawie tego. Ponieważ otrzymałem nazwę osoby lub organizacji w innym EditText, potrzebowałem dalszej weryfikacji 4 i 5 litery.
Okazuje się [A-Z]{3}[C,H,F,A,T,B,L,J,G,P]{1}**something for the fifth character**[0-9]{4}[A-Z]{1}
nie jestem w stanie dowiedzieć się, w jaki sposób coś musi być napisane.
Programowo można to zrobić, someone has done it in rails, ale czy można tego dokonać za pomocą wyrażeń regularnych? W jaki sposób?
nie próby (p | [° C, H, K, A, T, B, L, J, g]) –
nie mógł zrozumieć 3. punkt. Ile jest obecnych znaków? –
@AvinashRaj jeśli czwarty znak na numerze karty PAN to P, to piąty znak będzie pierwszą literą twojego nazwiska, Dla np. Jeśli jesteś Avinash Raj, twoja czwarta postać w pancardzie będzie miała P dla Osobistego, a piąta będzie R z Raju. Natomiast jeśli karta PAN należy do organizacji, powiedzmy, że firma to czwarta postać to C dla firmy, a piąta postać to pierwsza litera nazwy firmy, na przykład, jeśli istnieje firma o nazwie "Microsoft Corporation", wówczas Czwarta postać będzie oznaczać "C" dla firmy, a piąta będzie oznaczać "M" dla Microsoft. – inquisitive