PatternRegex
Validate an Indian PIN code
Confirm a postal PIN code field holds exactly six digits and doesn't start with a zero, matching how India's postal zones are numbered.
Last updated
Matches
- 110001
- 400001
- 560001
Doesn’t match
- 012345
- 12345
- 1100011
Why it’s written this way
India's PIN codes are always six digits, and the first digit identifies one of nine postal zones numbered 1 through 9 — zone 0 was never assigned, so [1-9] for the leading digit followed by \d{5} for the rest both matches the real numbering scheme and rejects an obviously wrong leading zero.
Anchoring with ^ and $ keeps the check to exactly six characters — a seven-digit string, or a PIN code with a stray trailing space, won't slip through.
Edge cases to know
- →It confirms the shape of a PIN code, not that the code is actually assigned to a real post office — that lookup needs India Post's own data, not a regex.
- →It doesn't distinguish delivery post offices from ones that exist only for sorting, so a shape-valid PIN may still not accept parcel delivery.
- →Whitespace or punctuation anywhere in the string fails the match — trim the input before testing it.