Skip to main content
The sanitize pre-hook scans input text for personally identifiable information (PII). It supports 50+ pattern types, 5 checksum validators, and 6 categories — with a focus on EU member state identifiers.

Three Modes

Categories & Types

National IDs (identity_national)

8 EU/US national identification numbers.

Passports (identity_passport)

14 EU country formats + generic international passport pattern.

Financial (financial)

Contact (contact)

Medical (medical)

GDPR Art.9 Special Categories (gdpr_art9)

8 context-dependent patterns for special category data. These use keyword context matching — a pattern must appear alongside relevant context keywords to trigger.

Checksum Validators

Five types use algorithmic validation to reduce false positives:

Pattern Priority

Patterns are ordered for matching priority — specific patterns with validators run first, generic patterns last:
1

National IDs

Most specific: SSN, BSN (with 11-check), NIR (with mod-97), PESEL, Codice Fiscale
2

Financial

IBAN (with mod-97), credit cards, SWIFT/BIC
3

Medical

EHIC, KVNR, Carte Vitale, NHS
4

GDPR Art.9

Context-dependent special categories
5

Contact

Generic: email, phone, IP addresses
6

Passports

Most generic: country-specific and generic passport formats

Configuration

Set sanitizeMode and other options.

Error Handling

PIIDetectedError reference.