Skip to content

Instantly share code, notes, and snippets.

View janimuhlestein's full-sized avatar
💭
Looking for a job!

Jani Muhlestein janimuhlestein

💭
Looking for a job!
View GitHub Profile
@janimuhlestein
janimuhlestein / ssn-regex.md
Created November 24, 2020 07:56
An analysis of the regular expression for verifying a social security number.

Defining a search pattern within a block of text.

Regular expressions are a series of characters that create a pattern for the code to use in searching for specific strings within text. They are used for several different things, such as finding types of text within a string, verifying user-entered data such as card numbers, phone numbers, and email addresses.

Summary

The regex I have chosen to explain is that for verifying a social security number. The regex itself is ^(?!666|000|9\d{2})\d{3}-(?!00)\d{2}-(?!0{4})\d{4}$.

Table of Contents

Using a regular expression to verify a social security number.

Regular expressions are a series of characters that create a pattern for the code to use in searching for specific strings within text. They are used for several different things, such as finding types of text within a string, verifying user-entered data such as social security numbers.

Summary

The regex I have chosen to explain is that for verifying a social security number. The regex itself is ^(?!666|000|\\d{2})\\d{3}-(?!00)\\d{2}-(?!0{4}\\d{4}$.

Table of Contents