Validating social security cards
Anyone out there know how to improve this function?I'm not worried about shortening the code, I'm sure this could be done with better regex, I am more concerned about correct logic.An ITIN is only available to resident and nonresident aliens who are not eligible for U. employment and need identification for other tax purposes.You can identify an ITIN because it is a 9-digit number, beginning with the number "9" and is formatted like an SSN (NNN-NN-NNN)The Social Security Administration is initiating a new randomization process to "extend the longevity of the nine-digit SSN nationwide," so numbers issued after June 25, 2011, won't be tied to a specific state.Given that there are gaps in the actual domain due to the allocation schema and that there are more than 300m people currently alive in the US, most of whom have social security numbers, nearly a third of the possible domain is taken.Won't be long until we start seeing collisions. Answer 5 years after initial question due to changes in validation rules by the Social Security Administration.
Also there are a few specific numbers to invalidate according to this link: how I did it.
Only the first two specific rules have any substantiated claim AFAIK.
In addition the previous excluded ranges are now allowed.
The Social Security Administration allows you to verify Social Security numbers online.
If you receive a Social Security card from a new employee and you aren't sure if it's real, or if the employee doesn't have a card or forgot the number, you can verify the number online.