Skip to content

Instantly share code, notes, and snippets.

@sh4t
Created November 15, 2015 10:15
Show Gist options
  • Save sh4t/c64a95d09334aef2c9c2 to your computer and use it in GitHub Desktop.
Save sh4t/c64a95d09334aef2c9c2 to your computer and use it in GitHub Desktop.

Revisions

  1. sh4t created this gist Nov 15, 2015.
    12 changes: 12 additions & 0 deletions regex.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    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