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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find US SSN pattern match
Expression
\b(?!000)(?!666)(?!9)[0-9]{3}[ -]?(?!00)[0-9]{2}[ -]?(?!0000)[0-9]{4}\b
Description
Finds 9 digit numbers within word boundaries, not separated or separated by - or space, not starting with 000, 666, or 900-999, not containing 00 or 0000 in the middle or at the end of SSN (in compliance with current SSN rules).
Matches
123-45-6789, 123 45 6789, 123456789, 123-45 6789, 123-456789, 123 456789, etc.
Non-Matches
000-45-6789, 666-45-6789, 123-00-6789, 123-45-0000, 900-45-6789 through 999-45-6789
Author Rating: Not yet rated. Jeff Pentz
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

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