Skip to main content

Postal Regex Repository

A community-maintained repository of postal/ZIP code regex patterns for 25+ countries, with auto-generated tests and schema validation.
This project is ideal for form validation, data cleaning, and big data applications.


Features

  • ✅ 25+ countries included, with postal code regex patterns
  • ✅ Supports lookup by country code or country name
  • ✅ Precompiled regex for fast validation in Python
  • ✅ Auto-generated tests using sample_valid and sample_invalid entries
  • ✅ JSON schema ensures consistent data structure
  • ✅ Ready for big data frameworks like Spark, Dask, or Pandas

Usage

from postal_regex.validator import validate, normalize, get_supported_countries

# Validate postal codes
validate("IN", "110001")          # True
validate("India", "110001")       # True
validate("US", "12345-6789")      # True

# Normalize country identifiers
normalize("India")                # "IN"
normalize("US")                   # "US"

# List all supported countries
get_supported_countries()
# [{'code': 'IN', 'name': 'India'}, {'code': 'US', 'name': 'United States'}, ...]

---

Release files for postal-regex 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for postal-regex 1.0.0
File Size Uploaded
postal_regex-1.0.0.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for postal-regex 1.0.0
File Interpreter ABI Platform
postal_regex-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / postal_regex-1.0.0.tar.gz

Download URL postal_regex-1.0.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ecfcb2f8d34898db777d37bd1a02642eaf8fc5e77e1cbe0a586b85293eee876e
BLAKE2b-256 checksum
How to use checksums
f23e2e85d92ded91eb4b25a31b3405e95eaa954f006aa9a76d4c30665ea7842c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / postal_regex-1.0.0-py3-none-any.whl

Download URL postal_regex-1.0.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8292b2cef037b9c77228ddd81df1bce32aa87c5443d93dbba3b0bc2d4b0476c6
BLAKE2b-256 checksum
How to use checksums
b55d6aba6da39a1a99461bcf40f40000d6d01f317850a7ef5f7996036b987abd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page