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. 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.
Actual Validation (takes into consideration all of the previous rules)
^(?!219-09-9999|078-05-1120)(?!666|000|9\d{2})\d{3}-(?!00)\d{2}-(?!0{4})\d{4}$
or (without dashes) :
^(?!219099999|078051120)(?!666|000|9\d{2})\d{3}(?!00)\d{2}(?!0{4})\d{4}$Read full article from Validating Social Security Numbers through Regular Expressions - CodeProject
No comments:
Post a Comment