Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 383229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:15:45+00:00 2026-05-12T15:15:45+00:00

Anyone out there know how to improve this function? I’m not worried about shortening

  • 0

Anyone out there know how to improve this function? I’m not worried about shortening the code, I’m sure this could be done with better regex, I am more concerned about correct logic. I have had a terrible time finding documentation for SSN #’s. Most of the rules I use below have come from other programmers who work in the credit industry (no sources cited).

  1. Are there any additional rules that
    you are aware of?

  2. Do you know if any of this is wrong?

  3. Can you site your sources?

    public static bool isSSN(string ssn)
    {
        Regex rxBadSSN = new Regex(@"(\d)\1\1\1\1\1\1\1\1");
    
        //Must be 9 bytes
        if(ssn.Trim().Length != 9)
            return false;
    
        //Must be numeric
        if(!isNumeric(ssn))
            return false;
    
        //Must be less than 772999999
        if( (Int32)Double.Parse(ssn.Substring(0,3)) > 772 )
        {
            //Check for Green Card Temp SSN holders
            // Could be 900700000
            //          900800000
            if(ssn.Substring(0,1) != "9")
                return false;
    
            if(ssn.Substring(3,1) != "7" && ssn.Substring(3,1) != "8")
                return false;
        }
    
        //Obviously Fake!
        if(ssn == "123456789")
            return false;
    
        //Try again!
        if(ssn == "123121234")
            return false;
    
        //No single group can have all zeros
        if(ssn.Substring(0,3) == "000")
            return false;
        if(ssn.Substring(3,2) == "00")
            return false;
        if(ssn.Substring(5,4) == "0000")
            return false;
    
        //Check to make sure the SSN number is not repeating
        if (rxBadSSN.IsMatch(ssn))
            return false;
    
        return true;
    }
    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T15:15:45+00:00Added an answer on May 12, 2026 at 3:15 pm

    UPDATE

    On June 25, 2011, the SSA changed the SSN assignment process to “SSN randomization”.[27] SSN randomization affects the SSN assignment process in the following ways:

    It eliminates the geographical significance of the first three digits of the SSN, previously referred to as the Area Number, by no longer allocating the Area Numbers for assignment to individuals in specific states.
    It eliminates the significance of the highest Group Number and, as a result, the High Group List is frozen in time and can be used for validation of SSNs issued prior to the randomization implementation date.
    Previously unassigned Area Numbers have been introduced for assignment excluding Area Numbers 000, 666 and 900–999.

    New Rules

    • The Social Security number is a nine-digit number in the format “AAA-GG-SSSS”. The number is divided into three parts.
    • The middle two digits are the Group Number. The Group Numbers range from 01 to 99.
    • The last four digits are Serial Numbers. They represent a straight numerical sequence of digits from 0001 to 9999 within the group.
    • Some special numbers are never allocated:
      • Numbers with all zeros in any digit group (000-##-####, ###-00-####, ###-##-0000).
      • Numbers with 666 or 900-999 (Individual Taxpayer Identification Number) in the first digit group.
    • SSNs used in advertising have rendered those numbers invalid.

    http://en.wikipedia.org/wiki/Social_Security_number#Structure

    Previous Answer

    Here’s the most-complete description of the makeup of an SSN that I have found.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of an application or system out there for tracking changes (files
Is anyone out there using Team Foundation Server within a team that is geographically
Can anyone out there recommend a good online resource for CSS 'design patterns'? I
Has anyone out there got a good set of instructions for building/compiling Ruby from
Is anyone out there still using DataFlex? If so, what are you favorite tips
Has anyone out there used TFS's API to synchronize different types of repositories? I
Is anyone out there using Drupal for large scale, business critical enterprise applications? Does
Has anyone out there used Postsharp AOP framework in a production environment? Are there
I was curious if anyone out there has experience getting the necessary legal documents
Question: Is anyone out there familiar enough with Komodo Edit to shed some light

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.