Regex for Indian PIN Code
Regex Pattern
^[1-9][0-9]{5}$6-digit Indian PIN code
Quick Answer
The regex pattern for indian pin code is `^[1-9][0-9]{5}$`. 6-digit Indian PIN code. This works in JavaScript, Python, Ruby, PHP, Java, and most regex engines that support PCRE syntax.
Test Examples
| Input | Result |
|---|---|
| 110001 | ✓ Matches |
| 560001 | ✓ Matches |
| 400001 | ✓ Matches |
| 012345 | ✗ No match |
| 1234567 | ✗ No match |
| 12345 | ✗ No match |
Code Examples
javascript
const regex = /^[1-9][0-9]{5}$/;
const isValid = regex.test(value);python
import re
pattern = r'^[1-9][0-9]{5}$'
if re.match(pattern, value):
print("valid")ruby
pattern = /^[1-9][0-9]{5}$/
if value =~ pattern
puts "valid"
endphp
if (preg_match('/^[1-9][0-9]{5}$/', $value)) {
echo "valid";
}java
String pattern = "^[1-9][0-9]{5}$";
boolean isValid = value.matches(pattern);Frequently Asked Questions
Related Regex Patterns
US ZIP Code
5-digit ZIP or ZIP+4 format
UK Postcode
UK postcode format
Canadian Postal Code
Canadian postal code (letter-digit-letter digit-letter-digit)
Email Address
Validates a standard email address format
Email (RFC 5322 Compliant)
RFC 5322 compliant email validation with label length limits
URL (HTTP/HTTPS)
Validates HTTP and HTTPS URLs