US Social Security Number
intermediateMatches US SSN in XXX-XX-XXXX format with basic area number validation.
ssnsocial-securityusidentifier
Pattern
/(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}/gTry It
0 of 7 strings matched
Explanation
Matches SSN format with negative lookaheads to reject invalid area numbers (000, 666, 900-999), group numbers (00), and serial numbers (0000) per SSA rules.
Test Strings
Matching
- 123-45-6789
- 001-01-0001
- 899-99-9999
Non-matching
- 000-12-3456
- 666-12-3456
- 123-00-3456
- 123-45-0000
Language Compatibility
| Language | Support |
|---|---|
| JS | Full support |
| PYTHON | Full support |
| JAVA | Full support |
| PHP | Full support |
| GO | Not supported (RE2 engine) |
Code Snippets
const regex = /(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}/g;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);Common Variations
Without hyphens
(?!000|666|9\d{2})\d{3}(?!00)\d{2}(?!0000)\d{4}Matches SSN without separators