SSN Pattern

Based on which includes better validation based on rules defined in wikipedia.

This pattern matches the entire string if it contains an SSN pattern that is NOT surrounded by other number (ex: 00001-01-000100 will NOT match).

first line : start of line OR anything followed by at least one non-numeric/carriage return
second line : first group of numbers (cannot be 000 or 666, etc)
third line : optional hyphen separator
fourth line : second group of numbers (cannot be 00)
fifth line : optional hyphen separator
sixth line : third group of numbers (cannot be 0000)
seventh line : end of line OR at least one non-numeric/carriage return followed by anything
Code Snippet








Created 2015-04-28
comments powered by Disqus