NOTICE: This article is intended for Venio Console, and Venio Console versions released prior to the inclusion of the "Entity Extraction" feature.
Common PII Regular Expressions
U.S. Social Security numbers:
\b(?!000|666|9\d{2})([0-8]\d{2}|7([0-6]\d))([-]?|\s{1})(?!00)\d\d\2(?!0000)\d{4}\b
U.S. ZIP codes:
^((\d{5}-\d{4})|(\d{5})|([A-Z]\d[A-Z]\s\d[A-Z]\d))$
IPV4 addresses:
^\d{1,3}[.]\d{1,3}[.]\d{1,3}[.]\d{1,3}$
Email addresses:
^[\w\.=-]+@[\w\.-]+\.[\w]{2,3}$
Phone Numbers:
(((\+?1(\.|-|\s*)?)?\s*)((\d{3}(\.|-|\s*)?)?\s*)(\d{3}(\.|-|\s*)?\s*)(\d{4}\s*((x|ext\.?(ension)?)\s*\d*)?))
For credit cards, here are a few regular expressions based on patterns used by some specific financial institutions:
Visa: All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13.
^4[0-9]{12}(?:[0-9]{3})?$
MasterCard: MasterCard numbers either start with the numbers 51 through 55 or with the numbers 2221 through 2720. All have 16 digits.
^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$
American Express: American Express card numbers start with 34 or 37 and have 15 digits.
^3[47][0-9]{13}$
Diners Club: Diners Club card numbers begin with 300 through 305, 36 or 38. All have 14 digits. There are Diners Club cards that begin with 5 and have 16 digits. These are a joint venture between Diners Club and MasterCard, and should be processed like a MasterCard.
^3(?:0[0-5]|[68][0-9])[0-9]{11}$
Discover: Discover card numbers begin with 6011 or 65. All have 16 digits.
^6(?:011|5[0-9]{2})[0-9]{12}$
JCB: JCB cards beginning with 2131 or 1800 have 15 digits. JCB cards beginning with 35 have 16 digits. 222222
^(?:2131|1800|35\d{3})\d{11}$
Comments
0 comments
Please sign in to leave a comment.