Regular Expressions 101

Community Patterns

1...34567...301

Social Security Number (SSN)

3

Regular Expression
ECMAScript (JavaScript)

/
^((?!666|000)[0-8][0-9\_]{2}\-(?!00)[0-9\_]{2}\-(?!0000)[0-9\_]{4})*$
/
gm

Description

tests for valid social security numbers according to the social security administration. more specifically: -disallows a group to have all 0s -disallows first group to have all 6s -disallows a ssn to begin with 9

note that this does not test for issued ssn's. that would be impossible to implement here, because the high group document is continuously updated on a monthly basis.

Submitted by noxToken - 9 years ago