EasyRegex Logo
EasyRegex
Nouveau

Match American Social Security Number

Javascript

Expression Régulière

\b\d{3}-\d{2}-\d{4}\b
Copier
Avez-vous des Retours ?

Explication

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

Exemple d'Utilisation

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

Expressions Régulières Similaires