EasyRegex Logo
EasyRegex
Nuovo

Match American Social Security Number

Javascript

Espressione Regolare

\b\d{3}-\d{2}-\d{4}\b
Copia

Spiegazione

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

Esempio di Utilizzo

const regex = /\b\d{3}-\d{2}-\d{4}\b/; 
const ssn = '123-45-6789'; 
console.log(regex.test(ssn)); // Output: true
Copia
Prova l'espressione

Espressioni Regolari Simili