Validationflags: g

US Social Security Number

Match US Social Security Numbers in the canonical XXX-XX-XXXX format.

Try it in RegexPro

Pattern

regexJavaScript
/\b\d{3}-\d{2}-\d{4}\b/g

Raw source: \b\d{3}-\d{2}-\d{4}\b

How it works

Three digits, hyphen, two digits, hyphen, four digits. Word boundaries prevent false matches inside longer digit runs. Note: this pattern does not validate SSN issuance rules.

Examples

Input

123-45-6789

Matches

  • 123-45-6789

Input

SSN: 987-65-4321 on file

Matches

  • 987-65-4321

Input

123456789

No match

Common use cases

  • PII detection in logs or documents
  • Data loss prevention (DLP) scanning
  • Form field validation in US apps
  • Redaction pipelines for compliance