Regex reference
Pattern syntax used across URL and content policies.
In this section
GDPR-
Here are regex patterns for each category of PII under GDPR.
Name:
Regex: b[A-Z][a-z]+s[A-Z][a-z]+b Explanation: Matches names with a capitalized first and last name (e.g., "John Doe").
Address (Postal):
Regex: (d{1,5}sw+(sw+)*,?sw+(sw+)*,?s?w{2}s?d{5}) Explanation: Matches common address formats (e.g., "123 Main Street, Anytown, NY 12345").
Email Address:
Regex: b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,}b Explanation: Matches most email addresses (e.g., " user@example.com ").
Phone Number:
Regex: +?d{1,4}[s.-]?(?d{1,3})?[s.-]?d{1,4}[s.-]?d{1,4}[s.-]?d{1,9} Explanation: Matches international and local phone numbers (e.g., "+1-800-555-1234").
Identification Numbers (e.g., Passport, SSN):
Regex: b[0-9]{3}-[0-9]{2}-[0-9]{4}b|b[A-Z]{2}[0-9]{6}b Explanation: Matches U.S.
IP Address:
Regex: b(?:d{1,3}.){3}d{1,3}b Explanation: Matches IPv4 addresses (e.g., "192.168.1.1").
Cookie Identifiers:
Regex: b[a-f0-9]{32}b Explanation: Matches 32-character hexadecimal strings commonly used for cookies.
Device Identifiers:
Regex: b[A-Fa-f0-9]{2}(:[A-Fa-f0-9]{2}){5}b Explanation: Matches MAC addresses (e.g., "00:1A:2B:3C:4D:5E").
Geolocation Data:
Regex: b[-+]?([1-8]?d(.d+)?|90(.0+)?),s*[-+]?(180(.0+)?|((1[0-7]d)|(d{1,2}))(.d+)?)b Explanation: Matches latitude and longitude coordinates (e.g..
Bank Account Numbers:
Regex: bd{8,18}b Explanation: Matches typical bank account numbers (8 to 18 digits).
Credit/Debit Card Numbers:
Regex: b(?:d{4}[-s]?){3}d{4}b Explanation: Matches credit card numbers (e.g., "1234 5678 9012 3456").
Racial or Ethnic Origin:
Regex: b(Black|White|Asian|Hispanic|Latino|Arab|Mixed|Native)b Explanation: Matches broad racial or ethnic terms.
Political Opinions:
Regex: b(Conservative|Liberal|Socialist|Democrat|Republican|Green Party|Communist)b Explanation: Matches common political affiliations.
Religious or Philosophical Beliefs:
Regex: b(Christian|Muslim|Hindu|Jewish|Atheist|Buddhist|Agnostic)b Explanation: Matches major religions and beliefs.
Health Data:
Regex: b(diabetes|cancer|HIV|allergy|depression|anxiety)b Explanation: Matches health conditions.
Genetic Data:
Regex: b[ACGT]{10,}b Explanation: Matches DNA sequences.
Biometric Data:
Regex: b(?:iris|fingerprint|face|palm)b Explanation: Matches terms related to biometric data types.
Employment History:
Regex: b(Company|Position|Title|Manager|Intern|Employee)b Explanation: Matches terms indicating employment history.
Educational Qualifications:
Regex: b(Bachelor's|Master's|PhD|High School|Diploma|Degree)b Explanation: Matches typical educational qualifications.
Date of Birth:
Regex: b(0[1-9]|[12][0-9]|3[01])[-/.](0[1-9]|1[0-2])[-/.](19|20)d{2}b Explanation: Matches dates in DD/MM/YYYY, DD-MM-YYYY, or DD.MM.YYYY format.
Gender:
Regex: b(Male|Female|Non-binary|Transgender|Genderqueer)b Explanation: Matches gender terms.
Images or Video Recordings:
Regex: bw+.(jpg|jpeg|png|gif|bmp|mp4|avi|mov|mkv)b Explanation: Matches common image and video file formats.
Voice Recordings:
Regex: bw+.(mp3|wav|aac|flac)b Explanation: Matches common audio file formats.
Behavioral Data:
Regex: b(purchase|click|login|search|browse)b Explanation: Matches common behavioral actions.
CCPA-
These patterns are illustrative and may require adjustments based on specific use cases or variations in data formats:.
Real Name:
Regex: b[A-Z][a-z]+s[A-Z][a-z]+b Matches typical full names with proper capitalization (e.g., "John Doe").
Alias:
Regex: b[A-Za-z0-9_]{3,}b Matches usernames or aliases without spaces (e.g., "John_D123").
Postal Address:
Regex: d{1,5}sw+(sw+)*,?sw+(sw+)*,?s?[A-Z]{2}s?d{5} Matches U.S. addresses (e.g., "123 Main St, Springfield, IL 62704").
Unique Personal Identifier:
Regex: b[A-Za-z0-9_-]{8,}b Matches typical unique IDs (e.g., "abcd1234-efgh5678").
Online Identifier (IP Address):
Regex: b(?:d{1,3}.){3}d{1,3}b Matches IPv4 addresses (e.g., "192.168.1.1").
Email Address:
Regex: b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,}b Matches email addresses (e.g., "user@example.com").
Account Name:
Regex: b[A-Za-z0-9_-]{3,}b Matches typical account names (e.g., "user123").
Social Security Number:
Regex: bd{3}-d{2}-d{4}b Matches U.S. Social Security Numbers (e.g., "123-45-6789").
Driver’s License Number:
Regex: b[A-Z0-9]{1,9}b Matches generic license numbers (format varies by state).
Passport Number:
Regex: b[A-Z0-9]{6,9}b Matches typical passport numbers (e.g., "A1234567").
Phone Number:
Regex: +?d{1,4}[s.-]?(?d{1,3})?[s.-]?d{1,4}[s.-]?d{1,4}[s.-]?d{1,9} Matches international and local phone numbers (e.g., "+1-800-555-1234").
Signature:
Regex: .* Highly variable; typically matches any text entered as a signature.
Physical Characteristics or Description:
Regex: b(height|weight|eye color|hair color|build|complexion)b Matches descriptive terms for physical characteristics.
Telephone Number:
Regex: Same as Phone Number above.
Financial Information:
Regex: bd{4}[-s]?d{4}[-s]?d{4}[-s]?d{4}b Matches credit or debit card numbers (e.g., "1234 5678 9012 3456").
Medical Information:
Regex: b(diabetes|cancer|asthma|allergy|HIV|depression|anxiety|medication)b Matches common medical terms or conditions.
Health Insurance Information:
Regex: b[A-Z0-9]{8,12}b Matches typical health insurance ID formats.
Race or Ethnicity:
Regex: b(Black|White|Asian|Hispanic|Latino|Native|Mixed|Other)b Matches racial or ethnic terms.
Religion or Creed:
Regex: b(Christian|Muslim|Jewish|Hindu|Buddhist|Atheist)b Matches common religious affiliations.
Gender Identity or Expression:
Regex: b(Male|Female|Non-binary|Transgender|Genderqueer|Genderfluid)b Matches gender terms.
Sexual Orientation:
Regex: b(Gay|Lesbian|Bisexual|Heterosexual|Queer|Asexual)b Matches terms related to sexual orientation.
Products or Services Purchased:
Regex: b(product|service|purchase|order|subscription)b Matches terms related to purchases.
Purchase History:
Regex: b(bought|purchased|shopped|ordered|returned)b Matches terms indicating purchase activity.
Fingerprints, Faceprints, etc.:
Regex: b(fingerprint|faceprint|voiceprint|iris|retina|biometric)b Matches biometric-related terms.
Browsing/Search History:
Regex: b(search|browse|click|visit|navigate|login|logout)b Matches terms related to online activity.
Interaction with Applications/Websites:
Regex: b(app|site|interaction|click|ad|activity)b Matches terms for app or website interactions.
7. Geolocation Data
Regex: b([-+]?[1-8]?d(.d+)?|90(.0+)?),s*([-+]?((1[0-7]d)|(d{1,2}))(.d+)?|180(.0+)?)b Matches latitude and longitude coordinates (e.g., "37.7749.
Audio/Visual Data:
Regex: bw+.(mp3|wav|jpg|jpeg|png|mp4|avi|mov)b Matches common audio and video file formats.
Job History or Title:
Regex: b(manager|engineer|director|intern|consultant)b Matches job roles or titles.
School Records:
Regex: b(transcript|GPA|diploma|degree|school|university)b Matches terms related to education.
Preferences or Characteristics:
Regex: b(prefer|like|dislike|interest|trend|habit|aptitude)b Matches terms indicating inferences.
Notes:
These patterns are generalized and may require adjustments for specific data formats or industry contexts.
