validation

India PIN Code Regex Pattern

Validates Indian PIN (Postal Index Number) codes. PIN codes in India are exactly 6 digits and the first digit must be 1-9 (0 is not assigned as a first digit).

/^[1-9]\d{5}$/

What each part matches

^[1-9] — first digit 1-9 (not 0)
\d{5}$ — five more digits

✓ These match

  • 110001
  • 400001
  • 560034
  • 682001

✗ These don't

  • 012345
  • 11000
  • 1100011
  • ABC123

Use in your code

JavaScript

const re = /^[1-9]\d{5}$/;
re.test(input); // → true or false

Python

import re
re.fullmatch(r"^[1-9]\d{5}$", input)

PHP (PCRE)

preg_match('/^[1-9]\d{5}$/', $input);

Go

re := regexp.MustCompile(`^[1-9]\d{5}$`)
re.MatchString(input)

FAQ

Does this india pin code regex work in JavaScript?
Yes. Every pattern in the Utilko regex library is tested to work in JavaScript RegExp, PCRE (PHP, Nginx), and Python `re`. Where flavor matters (lookbehind, named groups), the pattern page flags it.
How do I use this pattern?
Copy the pattern from the code block above. In JavaScript: new RegExp('^[1-9]\d{5}$') or literal /^[1-9]\d{5}$/. Or click "Try in regex tester" to open it pre-loaded in Utilko's browser-based regex tester.
Should I use this for security-critical validation?
Client-side regex is fine for UX (immediate feedback on a form). For anything security-critical — payments, auth, data integrity — always re-validate server-side using the same pattern PLUS domain-specific checks (Luhn checksum for cards, actual email delivery test, DNS resolution for domains).

Related regex patterns

← All regex patterns · Regex tester · Regex cheat sheet