How to check PAN card?

How to check the correctness of the editing text for panning, for example "ABCDE1234F". I am confused how to check validation for this. Please help me guys. I would appreciate any help.

+12
java android validation android-edittext
source share
13 answers

You can use pattern matching regular expression

String s = "ABCDE1234F"; // get your editext value here Pattern pattern = Pattern.compile("[AZ]{5}[0-9]{4}[AZ]{1}"); Matcher matcher = pattern.matcher(s); // Check if pattern matches if (matcher.matches()) { Log.i("Matching","Yes"); } [AZ]{5} - match five literals which can be A to Z [0-9]{4} - followed by 4 numbers 0 to 9 [AZ]{1} - followed by one literal which can A to Z 

You can check regex @

http://java-regex-tester.appspot.com/

http://docs.oracle.com/javase/tutorial/essential/regex/

+32
source share

@ Raghunandan is right. You can use regex. If you see the wiki entry for Permanent_account_number (India) , you will get a value to generate the PAN card number. You can use the template to verify its validity. The relevant part is as follows:

PAN structure is as follows: AAAAA9999A: First five characters are letters, next 4 numerals, last character letter.

 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. 

`

Hope this helps.

+9
source share

This is the ideal PAN RegEx number::

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

There are several conditions for a PAN number :

A PAN (or PAN number) is an alphanumeric unique identifier ten characters long.

The PAN structure is as follows: AAAPL1234C :

The first five characters are letters (upper case by default) followed by four digits, and the last (tenth) character is a letter. The first three characters of the code are three letters forming a sequence of letters of the alphabet from AAA to ZZZ

the fourth character indicates the type of card holder. Each type of holder is uniquely identified by the letter from the list below:

  • A - Association of Persons (AOP)
  • B - Face Body (BOI)
  • C - Company
  • F - Firm
  • G - Government
  • H - HUF (undivided Hindu family)
  • L - Local government
  • J - Artificial Entity
  • P - Individual (owner)
  • T - Trust (AOP)
  • F - LLP (limited liability partnership)

The fifth PAN character is the first of the characters:

  • surname or name of the person, in the case of a "personal" PAN card, where the fourth character is "P" or
  • the name of the organization, trust, company or organization in the case of the company / HUF / firm / AOP / trust / BOI / local authority / artificial court / government, where the fourth character is "C", "H", "F", "A "," T "," B "," L "," J "," G ". The last (tenth) character is an alphanumeric used as a checksum to verify
+1
source share

card verification

regex: / (^ ([a-zA-Z] {5}) ([0-9] {4}) ([a-zA-Z] {1}) $) /

0
source share

You can use the keypress event to check the PAN card in C #

 enter code here 

private void textBox1_KeyPress (object sender, KeyPressEventArgs e)

  { int sLength = textBox1.SelectionStart; switch (sLength) { case 0: case 1: case 2: case 3: case 4: if (char.IsLetter(e.KeyChar) || Char.IsControl(e.KeyChar)) { e.Handled = false; } else { e.Handled = true; } break; case 5: case 6: case 7: case 8: if (char.IsNumber(e.KeyChar) || Char.IsControl(e.KeyChar)) { e.Handled = false; } else { e.Handled = true; } break; case 9: if (char.IsLetter(e.KeyChar) || Char.IsControl(e.KeyChar)) { e.Handled = false; } else { if (Char.IsControl(e.KeyChar)) { e.Handled = false; } else { e.Handled = true; } } break; default: if (Char.IsControl(e.KeyChar)) { e.Handled = false; } else { e.Handled = true; } break; } } 
0
source share
 ^([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}?$/ 

Try it. Hope it will work.

0
source share

Regular Exp of PANCARD- '/ [AZ] {5} \ d {4} [AZ] {1} / i';

use if you use angular js

controller

 $scope.panCardRegex = '/[AZ]{5}\d{4}[AZ]{1}/i'; 

HTML

 <input type="text" ng-model="abc" ng-pattern="panCardRegex" /> 
0
source share

Validating the correct format should be done using this regular expression:

/^[AZ]{3}[ABCFGHLJPT][AZ][0-9]{4}[AZ]$/

The difference from the other answers is that it takes into account that the fourth letter can take only certain values. All regex can be easily case-insensitive.

On the other hand, this check is too general, and the correct check formula for the last control letter will be much better than checking which position has a number or letter. Alas, this formula does not seem public.

0
source share

Try this

 $(document).ready(function() { $.validator.addMethod("pan", function(value1, element1) { var pan_value = value1.toUpperCase(); var reg = /^[a-zA-Z]{3}[PCHFATBLJG]{1}[a-zA-Z]{1}[0-9]{4}[a-zA-Z]{1}$/; var pan = { C: "Company", P: "Personal", H: "Hindu Undivided Family (HUF)", F: "Firm", A: "Association of Persons (AOP)", T: "AOP (Trust)", B: "Body of Individuals (BOI)", L: "Local Authority", J: "Artificial Juridical Person", G: "Govt" }; pan = pan[pan_value[3]]; if (this.optional(element1)) { return true; } if (pan_value.match(reg)) { return true; } else { return false; } }, "Please specify a valid PAN Number"); $('#myform').validate({ // initialize the plugin rules: { pan: { required: true, pan: true } }, submitHandler: function(form) { alert('valid form submitted'); return false; } }); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/jquery.validate.js"></script> <form id="myform" action="" method="post"> <div> <label>Pan Number</label> <div> <input type="text" name="pan" value="" id="input-pan" /> </div> </div> <button type="submit">Register</button> </form> 
0
source share

Hi to check the pan map you need to follow two steps of the process in your project.

1.) create a form and get a user card number

2.) upload the image of the user's pan-card

After completing both steps, do the logic in the backend for verification. To do this, you can follow the tutorial below:

https://www.lelocode.com/posts/pan-verification-in-laravel-using-baidu-ocr-universal-text-recognition-%28high-precision-version%29

0
source share

According to the Income Tax Act, the guidelines for a PAN card are as follows:

Format for pan-card: for example, ABCDE0123F

An income tax PAN card is issued in accordance with section 139A of the Income Tax Act. The PAN structure is as follows: AAAPL1234C: the first five (5) characters are letters, followed by four (4) digits, and the last (10th) character is a letter. The fourth (4th) symbol indicates the card holder.

For more information about the Pan map: https://en.m.wikipedia.org/wiki/Permanent_account_number

To check the code: "[AZ] {5} [0-9] {4} [AZ] {1}"

For Java:

 public static boolean isPanCardValid(String pan_number) { Pattern pattern = Pattern.compile("[AZ]{5}[0-9]{4}[AZ]{1}"); Matcher matcher = pattern.matcher(pan_number); // Check if pattern matches if (matcher.matches()) { return true; } else { return false; } } 

where isPanCardValid () is a static method that takes a string as a parameter (String pan_number), entered by the user, and matches it with the PanCard template and returns the value as true or false.

0
source share

Note that none of the other answers available so far have verified the PAN check digit .

Here is the Lun algorithm from http://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers#Java :

 public static boolean luhnTest(String number){ int s1 = 0, s2 = 0; String reverse = new StringBuffer(number).reverse().toString(); for(int i = 0 ;i < reverse.length();i++){ int digit = Character.digit(reverse.charAt(i), 10); if(i % 2 == 0){//this is for odd digits, they are 1-indexed in the algorithm s1 += digit; }else{//add 2 * digit for 0-4, add 2 * digit - 9 for 5-9 s2 += 2 * digit; if(digit >= 5){ s2 -= 9; } } } return (s1 + s2) % 10 == 0; } 
-one
source share

Very simple using a simple concept.

 long l = System.currentTimeMillis(); String s = l + ""; String s2 = ""; System.out.println(s.length()); for (int i = s.length() - 1; i > 8; i--) { s2+=s.charAt(i); } String pancardNo = "AVIPJ" + s2 + "K"; System.out.println(pancardNo); 

Use this unique punkar for testing.

-one
source share

All Articles