15,616,869 members
See more:
Hi;
I need Regular Expression for validating PAN No.
Thanks
Posted
Updated 28-Oct-20 23:30pm
vipan.net 27-Feb-16 0:20am
http://www.dotnetfunda.com/codes/show/1522/validate-indian-pan-number-using-regular-expression
Nirav Prabtani 15-Feb-17 2:56am
What have you tried ? Dont ask for your home work that you don't want to do

## Solution 3

PAN has specific format,

XXXXX9999X where X is a alphabatic character and 9 is a numeric digit.

<asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server" xmlns:asp="#unknown">
ValidationExpression="[A-Za-z]{5}\d{4}[A-Za-z]{1}">

Naresh Warbhe 24-Nov-12 8:17am
It works perfectly

pan-Number

Pan-Number

## Solution 1

As Per as PAN (Permanant account no) I have assume that,
Pan no must contain `10` chars,
among from 10 char each char either should be `Alphabetic uppercase` char or `numeric`.

So from my assumption constructed regex is.

`^[A-Z0-9]{10}\$`

and for complete understanding on `Regex` you could have this article to be useful,
The 30 Minute Regex Tutorial[^]

## Solution 7

"^[A-Z]{5}+[0-9]{4}+[A-Z]{1}\$"

----------------------------------------------

```package Programs;
import java.util.Scanner;
public class ValidatingEmail {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String phone = sc.next();
String regex = "^[A-Z]{5}[0-9]{4}[A-Z]{1}\$";
//Matching the given phone number with regular expression
boolean result = phone.matches(regex);
if(result) {
System.out.println("Given Pan-id is valid");
} else {
System.out.println("Given Pan-id is not valid");
}
}
}```

v2