Validating social security number
You can see this expression in action below: Using the Social Security Administration’s Validation Service If you truly need a reliable method of handling Social Security Number validation, the Social Security Administration offers a service that will properly validate a number for you, however it may not always be free or very quick.
You can visit the following page for more information on using the services they provide: Validating a Social Security Number using the Social Security Number .
I’ll provide a few different methods to handle the actual validation through Regular Expressions and let you determine which one might best suit your needs.
Background Info: Social Security Numbers A Social Security number (SSN) is a nine-digit number issued to U. citizens, permanent residents and temporary residents under section 205(c)(2) of the Social Security Act.
You can see an example of this in action below: While this may not look very fun at all, it will validate any valid Social Security Number as per the constraints (and exceptions) listed by the Social Security Administration.
Let’s break this one down to see what is going on: ^ # Start of expression (?!
Lenders must confirm each borrower’s identity prior to the extension of credit. See A3-2-01, Compliance With Laws, for additional information concerning borrower identity verification. Lenders must take steps to resolve any issues, including numbers not issued, borrower age/issue date discrepancies, or Social Security numbers associated with deceased individuals.
Fannie Mae’s requirements for borrower identity verification are intended to align with lenders’ existing federal obligations under laws requiring information and document verification, including the Department of Treasury's Office of Foreign Assets Control (OFAC) regulations and the U. Fannie Mae requires that each borrower has a valid Social Security number or Individual Taxpayer Identification Number (ITIN) (in addition to meeting existing legal residency and documentation requirements).
b(\d)1 -(\d)1 -(\d)1 b) # Don't allow all matching digits for every field (?! 666|000|9\d)\d # Don't allow the SSN to begin with 666, 000 or anything between 900-999 - # A dash (separating Area and Group numbers) (?!For your protection, we do not store any social security number entered on this page.Social Security Numbers This blog post focuses on validating the last of those: Social Security Numbers and why they may be a bit deceivingly more difficult to validate than you might expect.Since you no longer would have to worry about the highest group number and area number that had been assigned.However, you still can't just go throwing any values into there and expecting it to be valid as the Social Security Administration still has a few Social Security Numbers that are explicitly "off limits" as mentioned below.