Skip to content

Instantly share code, notes, and snippets.

@sh4t
Created November 15, 2015 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sh4t/c64a95d09334aef2c9c2 to your computer and use it in GitHub Desktop.
Save sh4t/c64a95d09334aef2c9c2 to your computer and use it in GitHub Desktop.
Useful Regular Expressions that I need to reference all the time

Regular Expressions

I end up needing to reference a bunch of useful expressions in my day to day work. In an effort to stop thinking about writing them, as I loathe writing regular expressions; I have started to maintain this list.

USA, Social Security Number(s) matching

No valid SSN begins with 666. Ignore them. ^((?!000)(?!666)([0-6]\d{2}|7[0-2][0-9]|73[0-3]|7[5-6][0-9]|77[0-1]))(\s|\-)((?!00)\d{2})(\s|\-)((?!0000)\d{4})$

Matches: 455-55-4444, 333 22-1111, 733 11 1111
Non-Matches: 734-00-1111, 749-11-0000, 666-11-1111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment