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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details Pattern Title
Expression
^(?=((0[1-9]0)|([1-7][1-7]\d)|(00[1-9])|(0[1-9][1-9]))-(?=(([1-9]0)|(0[1-9])|([1-9][1-9]))-(?=((\d{3}[1-9])$|([1-9]\d{3})$|(\d[1-9]\d{2})$|(\d{2}[1-9]\d)$))))
Description
I wrote this regular expression because a project I was working on required a stricter validator on social security numbers. There are actually gov't standards on what is a valid social: The first 3 digits can't be > 779, The first 3 digits can't be 000, The second 2 digits can't be 00, and the last 4 digits can't be 0000. This regex handles all these cases and checks formatting for numbering and dashes (###-##-####)
Matches
053-27-0293 | 770-29-2012 | 063-71-9123
Non-Matches
780-20-1230 | 000-24-1290 | 123-00-1239
Author Rating: Not yet rated. Scott Long
   Displaying page 1 of 1 pages; Items 1 to 1

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