Skip to main content

Postal code regex validator

Project description

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'}, ...]

---

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

postal_regex-1.0.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

postal_regex-1.0.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file postal_regex-1.0.0.tar.gz.

File metadata

  • Download URL: postal_regex-1.0.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for postal_regex-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ecfcb2f8d34898db777d37bd1a02642eaf8fc5e77e1cbe0a586b85293eee876e
MD5 495eac32b322852fa7dffaeea429293c
BLAKE2b-256 f23e2e85d92ded91eb4b25a31b3405e95eaa954f006aa9a76d4c30665ea7842c

See more details on using hashes here.

File details

Details for the file postal_regex-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: postal_regex-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for postal_regex-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8292b2cef037b9c77228ddd81df1bce32aa87c5443d93dbba3b0bc2d4b0476c6
MD5 cd4f3eee509ce516a99e020a9a75f334
BLAKE2b-256 b55d6aba6da39a1a99461bcf40f40000d6d01f317850a7ef5f7996036b987abd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page