PIIPatterns
Regex patterns for detecting Personally Identifiable Information (PII).
These patterns are designed for common US formats and can detect:
- Social Security Numbers (SSN)
- Credit Card Numbers
- Email Addresses
- Phone Numbers
- IP Addresses
- Passport Numbers
- Driver's License Numbers
- Bank Account Numbers
- Medical Record Numbers
Note: These patterns favor recall over precision - they may have false positives but minimize false negatives for security-sensitive use cases.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PIIPatterns.type
Members list
Type members
Classlikes
Represents a detected PII match with type and location.
Represents a detected PII match with type and location.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Types of PII that can be detected.
Types of PII that can be detected.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object BankAccountobject CreditCardobject DateOfBirthobject Emailobject IPAddressobject Passportobject Phoneobject SSNShow all
Value members
Concrete methods
Check if text contains any PII.
Check if text contains any PII.
Value parameters
- text
-
Text to scan
- types
-
PII types to detect
Attributes
- Returns
-
True if any PII found
Detect all PII matches in text using specified patterns.
Detect all PII matches in text using specified patterns.
Value parameters
- text
-
Text to scan
- types
-
PII types to detect (default: SSN, CreditCard, Email, Phone)
Attributes
- Returns
-
Sequence of matches with type and location
Mask all PII in text with redaction placeholders.
Mask all PII in text with redaction placeholders.
Value parameters
- text
-
Text to scan and mask
- types
-
PII types to mask
Attributes
- Returns
-
Text with PII replaced by [REDACTED_*] placeholders