Regular Expressions used in PII Scanning

PII Crawler doesn’t really use regular expressions as we find them to produce lots of false positives and aren’t as robust as other methods. That said, they can be useful if you already have existing tools you are working with that support regular expression rules or you have custom patterns you are looking for.

Here are some regular expressions you can use for targeting certain PII types.

Social Security Number (SSN):

\b(?!000|666|9\d{2})([0-8]\d{2}|7([0-6]\d|7[012]))([-]?)\d{2}\3\d{4}\b

Email Address:

\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Z|a-z]{2,}\b

US Phone Number:

\b(?:+1|1)?[-.\s]?(?[2-9]\d{2})?[-.\s]?\d{3}[-.\s]?\d{4}\b

Credit Card Number:

\b(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|6(?:011|5[0-9]{2})[0-9]{12}|(?:2131|1800|35\d{3})\d{11})\b

US Street Address:

\d{1,5}\s\w.\s(\b\w*\b\s){1,2}\w*.?

Date of Birth (various formats):

\b(0[1-9]|1[0-2])-/-/\d{2}\b|\b(19|20)\d{2}-/-/\b

IP Address (IPv4):

\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b

US Passport Number:

\b[A-Z]{1,2}[0-9]{6,9}\b

Driver’s License Number (generic format, may vary by state):

\b[A-Z]{1,2}[-\s]?\d{3,7}[-\s]?\d{3,7}\b

Full Name (simple format):

\b([A-Z][a-z]+)\s([A-Z][a-z]+)(?:\s([A-Z][a-z]+))?\b

💌 Get notified on new features and updates

Only sent when a new version is released. Nothing else.