Launching a SaaS?·Collect waitlist signups before you build — before.run
SandboxPatternsDetectDocsChangelog
Address
en-US
#zip
#postal
#us
#address

US ZIP Code

Matches a US ZIP code in 5-digit or ZIP+4 (5-4) format.

US address formsShipping validationGeographic targeting
/
/
Risk
Test String
3 matches
\d{5}digit\d — digit (0–9) — repeated exactly 5 times · {5} — exactly 5 times
(…)?Group #1Capturing group — captures matched text for reuse or extraction — repeated zero or one time (optional) · ? — zero or one time (optional)
--'-' — literal character
\d{4}digit\d — digit (0–9) — repeated exactly 4 times · {4} — exactly 4 times
Pattern: 14 charsInput: 22 chars
100% client-side · private

Valid Examples

  • 90210
  • 10001-1234
  • 00501

Invalid Examples

  • 1234
  • 123456
  • 9021A

Usage & Integration

Validate US ZIP Code natively in your backend or frontend without copying regex strings.

Node / Edge

import { validate } from '@regexto/validators';

validate('us-zip', '...');

Python

from regexto_validators import validate

validate("us-zip", "...")

Go

import "github.com/regex-to/validators-go"

valid, err := validators.Validate("us-zip", "...")

PHP

use RegexTo\Validators\Validator;

Validator::validate('us-zip', '...');

Rust

use regexto_validators::validate;

let is_valid = validate("us-zip", "...").unwrap();