RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Social Security Number - All Rules Enforced
Expression
^((?!000)(?!666)(?:[0-6]\d{2}|7[0-2][0-9]|73[0-3]|7[5-6][0-9]|77[0-2]))-((?!00)\d{2})-((?!0000)\d{4})$
Description
Could not find a regex that truly matched the rules here http://en.wikipedia.org/wiki/Social_Security_number#Valid_SSNs So I modified an existing one to match the valid SSN rules. The first digit set will not match: 000, 666, 734 to 749, and greater than 772. * Numbers with all zeros in any digit group (000-xx-####, ###-00-####, ###-xx-0000)
Matches
455-55-4444|333-22-1111|733-11-1111
Non-Matches
734-11-1111|749-11-1111|772-11-1111
Author Rating: The rating for this expression. Tim Cartwright
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Other SSN Validation Rules
Name: Dale W
Date: 4/20/2011 11:32:48 AM
Comment:
I found this website with additional rules for exclusion http://www.searchbug.com/peoplefinder/invalid-social-security-numbers.aspx The Social Security Administration now recommends that people showing Social Security cards in advertisements use numbers in the range 987-65-4320 through 987-65-4329. According to one source the following SSNs have been used in ads: 002-28-1852 042-10-3580 062-36-0749 078-05-1120 095-07-3645 128-03-6045 135-01-6629 141-18-6941 165-16-7999 165-18-7999 165-20-7999 165-22-7999 165-24-7999 189-09-2294 212-09-7694 212-09-9999 306-30-2348 308-12-5070 468-28-8779 549-24-1889


Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials