DD
DevDash

Regex for Indian PAN Number

Regex Pattern

^[A-Z]{5}\d{4}[A-Z]$

Indian Permanent Account Number (AAAAA1234A)

Quick Answer

The regex pattern for indian pan number is `^[A-Z]{5}\d{4}[A-Z]$`. Indian Permanent Account Number (AAAAA1234A). This works in JavaScript, Python, Ruby, PHP, Java, and most regex engines that support PCRE syntax.

Test Examples

InputResult
ABCDE1234F✓ Matches
ZZZZZ9999Z✓ Matches
AABBC1234D✓ Matches
ABCDE123F✗ No match
abcde1234f✗ No match
12345ABCDE✗ No match

Code Examples

javascript

const regex = /^[A-Z]{5}\d{4}[A-Z]$/;
const isValid = regex.test(value);

python

import re
pattern = r'^[A-Z]{5}\d{4}[A-Z]$'
if re.match(pattern, value):
    print("valid")

ruby

pattern = /^[A-Z]{5}\d{4}[A-Z]$/
if value =~ pattern
  puts "valid"
end

php

if (preg_match('/^[A-Z]{5}\d{4}[A-Z]$/', $value)) {
    echo "valid";
}

java

String pattern = "^[A-Z]{5}\\d{4}[A-Z]$";
boolean isValid = value.matches(pattern);

Frequently Asked Questions

Related Regex Patterns

Want API access + no ads? Pro coming soon.