Government Identification Numbers
These regular expressions are aimed at redacted personally identifiable information related to government records such as tax ids, government issued ids, and more.
Argentina
National Identity (DNI) Number
\d{2}\.\d{3}\.\d{3}
This regular expression matches the following examples.
- 34.960.099
- 63.889.141
- 40.571.278
- 45.855.200
- 80.933.831
Australia
Tax File Number
The Australian tax file number is typically 8-9 digit numbers preceded by TFN. Other indicators in the government website may say things like payee's tax file number or tax file number.
Typically, on most instances we can use these indicators to confirm that the 8-9 digits are a TFN.
For example, when the TFN appears like TFN: 12345678
, we can search for TFN:
and then use the Blackout named group redaction hint to only redact the numbers.
TFN(:|:\s|\s|)(?<redact>(\d{8,9})
This regular expression will match TFN: 12345678
but will only place a redaction on the 12345678
.
Canada
Passport ID
This regular expression will match Canadian passport IDs.
\b[\w]{2}[\d]{6}\b
Croatia
Vat ID card number
This regular expression will match Croatian VAT ID card number.
\bHR\d{11}\b
Czech Republic
Vat ID card number
This regular expression will match Czech Republic VAT ID card number.
\bCZ\d{8,10}\b
Denmark
Personal ID number
This regular expression will match Denmark Personal ID number.
\b\d{10}|\d{6}[-\s]\d{4}\b
France
National ID card (CNI)
This regular expression will match France's National ID card (CNI)
\b\b\d{12}\b\b
Social Security Number (INSEE)
This regular expression will match France's Social Security Number (INSEE)
\b\d{13}|\d{13}\s\d{2}\b
Driver's license ID
This regular expression will match France's Driver's license ID
\b\d{12}\b
Passport ID
This regular expression will match France's Passport ID
\b\d{2}11\d{5}\b
Germany
ID card number
This regular expression will match Germany's ID card number
\bl\d{8}\b
Passport ID
This regular expression will match Germany's Passport ID
\b[cfghjk]\d{3}\w{5}\d\b
Driver's License ID
This regular expression will match Germany's Driver's License ID
\b[\d\w]\d{2}[\d\w]{6}\d[\d\w]\b
Ireland
Personal Public Service (PPS) Number
This regular expression will match Personal Public Service (PPS) Number
\b\d{7}\w{1,2}\b
Netherlands
Citizen's Service (BSN) number
This regular expression will match Citizen's Service (BSN) number
\b\d{8}|\d{3}[-\.\s]\d{3}[-\.\s]\d{3}\b
Poland
National ID (PESEL)
This regular expression will match Poland's National ID (PESEL)
\b\d{11}\b
Portugal
Citizen Card Number
This regular expression will match Portugal's Citizen Card Number
\d{9}[\w\d]{2}|\d{8}-\d[\d\w]{2}\d
Spain
Social Security Number (SSN)
This regular expression will match Spain's SSN
\b\d{2}\/?\d{8}\/?\d{2}\b
Sweden
Passport ID
This regular expression will match Sweden's Passport ID
\b\d{8}\b
United Kingdom
Passport ID
This regular expression will match United Kingdom's Passport ID
\b\d{9}\b
Driver's license ID
This regular expression will match United Kingdom's Driver's license ID
\b[\w9]{5}\d{6}[\w9]{2}\d{5}\b
National Health Service (NHS) number
This regular expression will match United Kingdom'sNational Health Service (NHS) number
\b\d{3}\s\d{3}\s\d{4}\b
United States
Social Security Number (SSN)
These regular expressions are optimized for image and Excel respectively. The image version of the SSN Regex is specifically created to be defensive against common OCR mistakes such as 1 being read as l
, i
, or I
.
Image Projects
\b[\dlZEASBO]{3} [\dlZEASBO]{2} [\dlZEASBO]{4}|([\dlZEASBO] ?){3}[\—\-_] ?([\dlZEASBO] ?){2}[\—\-_] ?([\dlZEASBO] ?){4}\b
Excel Projects
\b[\d]{3} [\d]{2} [\d]{4}|([\d] ?){3}[\—\-_] ?([\d] ?){2}[\—\-_] ?([\d] ?){4}\b