EasyRegex Logo
EasyRegex
Nuevo

Match American Social Security Number

Javascript

Expresión Regular

\b\d{3}-\d{2}-\d{4}\b
Copiar
¿Tienes Comentarios?

Explicación

This regex pattern matches the American Social Security number format, which consists of three digits, a hyphen, two digits, another hyphen, and four digits. The \b ensures that it matches the whole Social Security number as a separate word.

Javascript

Ejemplo de Uso

const regex = /\b\d{3}-\d{2}-\d{4}\b/; 
const ssn = '123-45-6789'; 
console.log(regex.test(ssn)); // Output: true
Copiar
Prueba la expresión

Expresiones Regulares Similares