Skip to content

Pattern Catalogue

daniele frisanco edited this page Jul 5, 2026 · 1 revision

Pattern Catalogue

89 built-in patterns across 9 tags. This page groups them by tag and by country for the PII patterns. The authoritative, index-by-index source is ext/data_redactor/patterns.c (the pattern_names / pattern_tags arrays) — if anything here drifts, that file wins.

Redact by tag or by exact name:

DataRedactor.tags
# => [:credentials, :financial, :tax_id, :national_id, :contact, :network, :travel, :other, :custom]

DataRedactor.redact(text, only: [:credentials])          # a whole tag
DataRedactor.redact(text, only: ["aws_access_key_id"])   # one pattern
DataRedactor.redact(text, only: :contact, except: ["email"])

Word-boundary protection (¹). Generic digit/alphanumeric formats are wrapped at compile time with (^|[^0-9A-Za-z])(PATTERN)([^0-9A-Za-z]|$) so they don't fire inside a longer token. Patterns with a distinctive prefix (API keys, IBANs) need no boundary. See C Engine Internals for how the tiers are ordered.


:credentials — cloud & API secrets

Long, prefixed tokens — matched by their distinctive prefix, no boundary needed.

Pattern Example
AWS Access Key ID AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key 40-char base64 string (see limitation)
Google API Key AIzaSyXXXX…
Anthropic API Key sk-ant-api03-XXXX…
OpenAI Project API Key sk-proj-XXXX…
GitHub PAT (fine-grained) github_pat_XXXX…
GitHub Classic PAT / OAuth ghp_XXXX… / gho_XXXX…
GitLab PAT glpat-XXXX…
Stripe Secret Key sk_live_XXXX…
SendGrid API Key SG.XXXX…
DigitalOcean PAT dop_v1_XXXX…
Databricks API Token dapiXXXX…
Grafana / LaunchDarkly / ClickUp / Scaleway keys prefix-anchored
HashiCorp Vault (service/batch) & Terraform tokens hvs. / hvb. / prefix
Amazon MWS Auth Token prefix-anchored
Slack Webhook URL https://hooks.slack.com/services/T…/B…/…
Microsoft Teams Webhook full URL
MongoDB connection string mongodb://… / mongodb+srv://…
Sentry DSN https://KEY@oNNN.ingest.sentry.io/PID
URI with embedded password scheme://user:pass@host
JWT eyJ…​.eyJ…​.…
Bearer token Authorization: Bearer …
SSH public key ssh-rsa …, ssh-ed25519 …
PEM / GPG private key header -----BEGIN … PRIVATE KEY-----
Keyname-anchored secret password=…, api_key: …, etc.

:financial — IBANs, cards, tax-ish numbers

Credit card — Visa, Mastercard, Amex, Discover, JCB — 4111111111111111.

IBANs, longest → shortest (prefix-anchored by the two-letter country code):

Country Example Country Example
Italy IT60X0542811101000000123456 Sweden SE4550000000058398257466
France FR7630006000011234567890189 Denmark DK5000400440116243
Germany DE89370400440532013000 Norway NO9386011117947
Spain ES9121000418450200051332 Finland FI2112345600000785
Netherlands NL91ABNA0417164300 Poland PL61109010140000071219812874
Belgium BE68539007547034 Austria AT611904300234573201
Portugal PT50000201231234567890154 Switzerland CH9300762011623852957
Ireland IE29AIBK93115212345678 Czechia CZ6508000000192000145399
Hungary HU42117730161111101800000000
Romania RO49AAAA1B31007593840000

:tax_id — tax identifiers ¹

Country Type Example
Italy Codice Fiscale RSSMRA85M01H501Z
Italy Codice Fiscale (omocodia) RSSMRALPMNLH5LMZ
Spain DNI 12345678Z
UK National Insurance No. QQ123456C
USA ITIN 912-34-5678
Canada SIN 123-456-789
India PAN ABCDE1234F
Hungary Tax ID 8012345678
France NIR / Social Security 185126203450342
Poland PESEL (tax slot) 85121612345

:national_id — national personal identifiers ¹

Country Type Example Country Type Example
Spain NIE X1234567L Denmark CPR 010185-1234
Netherlands BSN 123456789 Czechia Rodné číslo 856121/1234
Poland PESEL 85121612345 Korea RRN 850101-1234567
Belgium National No. 85121612345 Japan My Number 123456789012
Sweden Personnummer 850101-1234 India Aadhaar 1234 5678 9012
Norway Fødselsnummer 01018512345 Mexico CURP HEGG560427MVZRRL04
Finland HETU 010185-123A Australia TFN 123456782
Switzerland AHV 756.1234.5678.90 South Africa ID 8001015009087
Austria Abgabenkontonummer 123456789 Romania CNP 1850101123456

:contact

Pattern Example
Email alice@example.com
Phone (E.164) +14155552671

:network

Pattern Example
IPv4 address 192.168.1.100

:travel

Pattern Example
Passport — letter prefix + digits AB1234567
Passport — 9 consecutive digits ¹ 123456789

:other

Pattern Example
UUID v4 550e8400-e29b-41d4-a716-446655440000

:custom

Empty by default — this is where your patterns land. See Custom Patterns & Name Patterns.


Notes on overlapping formats

Several national IDs share a digit length (e.g. 11-digit: PESEL, Norwegian Fødselsnummer, Belgian National Number). They are separate catalogue slots for clarity, but in practice any 11-digit boundary-delimited number will be redacted. This is a deliberate lean-toward-redacting tradeoff — see the FAQ and Known limitations.

Clone this wiki locally