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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Social Security Number
Expression
^(?!000)(?!666)(?!9)\d{3}([- ]?)(?!00)\d{2}\1(?!0000)\d{4}$
Description
Updated SSN regex. A very simple one for verifying a properly formatted US social security number. First three digits must be 001 - 899 and not 666. Disallows all zeros in a group.
Matches
123-45-6789
Non-Matches
123-45 6789 | 1234-56-7890 | 123-00-7890
Author Rating: The rating for this expression. tedcambron
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: Updated
Name: Ted Cambron
Date: 2/12/2008 10:02:36 PM
Comment:
I updated it so that the first three digits must be 001 - 772 like a real social security number.


Title: Can Be Improved
Name: Ted Cambron
Date: 2/11/2008 3:08:02 PM
Comment:
The first three digits should be 001 to 772. I will update later.


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