InRegex Logo
InRegex
Neu

US Zip Codes

Erklärung

This regex pattern matches US Zip Codes in the format of 5 digits or 5 digits followed by a hyphen and 4 digits. The \b ensures that the zip code is a whole word.

javascript

Regulärer Ausdruck

\b\d{5}(?:-\d{4})?\b
Kopieren
Haben Sie Feedback?
javascript

Beispielverwendung

const regex = /\b\d{5}(?:-\d{4})?\b/g;
const zipCodes = '12345, 54321-6789, 98765'.match(regex);
Kopieren

Testen Sie den Ausdruck

Ähnliche Reguläre Ausdrücke