EasyRegex Logo
EasyRegex
New

Match American Social Security Number

Javascript

Regular Expression

\b\d{3}-\d{2}-\d{4}\b
Copy
Do you have Feedback?

Explanation

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

Example Usage

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

Similar Regular Expressions