REGEXVAULTv2.0
Identity & PII/Location PII
Verified Safe

Street Address (US Format) Regex for JavaScript

/^[0-9]{1,6}(?:\s+(?:apt|unit|ste|suite|#)\s*[A-Za-z0-9]+)?\s+[A-Za-z0-9\s.'-]{3,50}(?:\s+(?:ave|avenue|blvd|boulevard|ct|cir|dr|drive|hwy|highway|ln|lane|pkwy|parkway|pl|place|rd|road|st|street|ter|terrace|trl|trail|way))?\.?$/i

What this pattern does

This page provides a comprehensive, battle-tested regular expression for matching street address (us format), ported and verified for JavaScript. Identity and credential patterns need both correctness and safety, since they're frequent targets for adversarial input. The snippet below is ready to drop into your JavaScript project — whether you're validating in an Express middleware, a Next.js API route, or a client-side form.

Javascript Implementation

Javascript
// Street Address (US Format)
// ReDoS-safe | RegexVault — Identity & PII > Location PII

const streetAddressUsFormatRegex = /^[0-9]{1,6}(?:\s+(?:apt|unit|ste|suite|#)\s*[A-Za-z0-9]+)?\s+[A-Za-z0-9\s.'-]{3,50}(?:\s+(?:ave|avenue|blvd|boulevard|ct|cir|dr|drive|hwy|highway|ln|lane|pkwy|parkway|pl|place|rd|road|st|street|ter|terrace|trl|trail|way))?\.?$/i;

function validateStreetAddressUsFormat(input: string): boolean {
  return streetAddressUsFormatRegex.test(input);
}

// Example
console.log(validateStreetAddressUsFormat("123 Main St")); // true

Test Cases

Matches (Valid)
Rejects (Invalid)
123 Main StMain St
456 Elm Avenue123
789 Oak BlvdJust A Name
1000 Willow Lane Apt 5B
1 Infinite Loop
123 Main

When to use this pattern

This pattern is drawn from the Identity & PII > Location PII category and carries a ReDoS-safe certification. That matters for JavaScript developers because especially critical in long-running Node.js event loops where a ReDoS vulnerability can block the entire process. RegexVault audits patterns against known backtracking attack vectors, ensuring you have the necessary context before using this regex in a high-stakes production environment.

Common Pitfalls

Address validation regex cannot verify that an address is deliverable. Use USPS CASS-certified address validation for mail delivery. For geocoding, use a geocoding API (Google Maps, Here).

Technical Notes

US addresses are extremely varied — this pattern covers the most common format but not all. PO Boxes, rural routes, and military addresses require different patterns. Use a dedicated address validation API (USPS, SmartyStreets) for reliable validation.

Have a pattern that belongs in the vault?

Submit it for review — community-verified patterns get credited to your GitHub handle. Free submissions join the queue. Priority review available for $15.

Submit a Pattern