InRegex Logo
InRegex
Nuevo

US Zip Codes

Explicación

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

Expresión Regular

\b\d{5}(?:-\d{4})?\b
Copiar
¿Tienes Comentarios?
javascript

Ejemplo de Uso

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

Prueba la expresión

Expresiones Regulares Similares