How to verify PAN card?

前端 未结 15 1429
予麋鹿
予麋鹿 2021-02-13 11:46

How to check the validation of edittext for pan card like \"ABCDE1234F\". I am confused how to check the the validation for this. Please help me guys. I will appreciate any kind

15条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-13 12:23

    This is perfect PAN number RegEx: :

    String panNumber = "AAAPL1234C"; // get your editext value here
    Pattern pattern = Pattern.compile("[A-Z]{3}[ABCFGHLJPTF]{1}[A-Z]{1}[0-9]{4}[A-Z]{1}");
    
    Matcher matcher = pattern.matcher(panNumber );
    // Check if pattern matches 
    if (matcher.matches()) {
        Log.i("Matching","Yes");
    }
    

    There are some condition for PAN number as follow :

    The PAN (or PAN number) is a ten-character long alpha-numeric unique identifier.

    The PAN structure is as follows: AAAPL1234C:

    The first five characters are letters (in uppercase by default), followed by four numerals, and the last (tenth) character is a letter. The first three characters of the code are three letters forming a sequence of alphabets letters from AAA to ZZZ

    The fourth character identifies the type of holder of the card. Each holder type is uniquely defined by a letter from the list below:

    • A — Association of persons (AOP)
    • B — Body of individuals (BOI)
    • C — Company
    • F — Firm
    • G — Government
    • H — HUF (Hindu undivided family)
    • L — Local authority
    • J — Artificial juridical person
    • P — Individual (proprietor)
    • T — Trust (AOP)
    • F – LLP (limited liability partnership)

    The fifth character of the PAN is the first character of either:

    • of the surname or last name of the person, in the case of a "personal" PAN card, where the fourth character is "P" or
    • of the name of the entity, trust, society, or organisation in the case of a company/HUF/firm/AOP/trust/BOI/local authority/artificial judicial person/government, where the fourth character is "C", "H", "F", "A", "T", "B", "L", "J", "G". The last (tenth) character is an alphabetic digit used as a check-sum to verify the

提交回复
热议问题