Dutch regexes¶
Python regexes for Dutch identifiers, with checksum validation: BSN, RSIN, KvK, btw-nummer, IBAN, passport and ID card, kenteken, postcode and phones.
23 regexes, from regular_regexes/nl/regexes.json, called as rre.nl.<name>(text).
Personal numbers (1) · Identity documents (3) · Companies and tax (4) · Banking and payments (3) · Phones and SIM cards (6) · Places and addresses (2) · Vehicles, ships and parcels (3) · Justice and police (1)
Personal numbers¶
| function | checksum validator |
|---|---|
rre.nl.bsn |
nl_bsn |
bsn¶
Dutch citizen service number (BSN, burgerservicenummer, sofinummer): nine digits after BSN, burgerservicenummer, sofinummer or persoonsnummer, keyword included, or on its own when written 1234.56.789.
rre.nl.bsn(text)
(?i:\b(?:bsn|burgerservicenummer|sofi[- ]?(?:nummer|nr)|persoonsnummer)\b)[^\d\n]{0,20}\d(?:[ .-]?\d){8}\b|(?<!\d\.)\b\d{4}\.\d{2}\.\d{3}\b(?!\.\d)
Matches are checked with nl_bsn; one that fails it is dropped.
Identity documents¶
| function | checksum validator |
|---|---|
rre.nl.document_number |
|
rre.nl.mrz_id_card |
mrz_td1 |
rre.nl.mrz_passport |
mrz_td3 |
document_number¶
Dutch passport or identity card number (documentnummer): two letters, six letters or digits and a final digit, never the letter O, like SPECI2014.
rre.nl.document_number(text)
\b[A-NP-Z]{2}[A-NP-Z\d]{6}\d\b
mrz_id_card¶
Machine-readable zone (MRZ) of a Dutch identity card, first line (ICAO TD1): 30 characters with NLD as issuing country, like I<NLDSPECI20142999999990<<<<<<.
rre.nl.mrz_id_card(text)
(?<![A-Z0-9<])[IAC][A-Z<]NLD[A-Z0-9<]{25}(?![A-Z0-9<])
Matches are checked with mrz_td1; one that fails it is dropped.
mrz_passport¶
Machine-readable zone (MRZ) of a Dutch passport, second line (ICAO TD3): 44 characters with the document number, NLD as nationality, date of birth, sex and expiry date.
rre.nl.mrz_passport(text)
(?<![A-Z0-9<])[A-Z0-9<]{9}\dNLD\d{6}\d[MFX<]\d{6}\d[A-Z0-9<]{14}[\d<]\d(?![A-Z0-9<])
Matches are checked with mrz_td3; one that fails it is dropped.
Companies and tax¶
| function | checksum validator |
|---|---|
rre.nl.company_name |
|
rre.nl.kvk_number |
|
rre.nl.rsin |
nl_bsn |
rre.nl.vat_number |
nl_vat_number |
company_name¶
Dutch company name (handelsnaam): capitalized words, initials, Gebr., Zn. or van/de/der, followed by B.V., BV, N.V., NV, V.O.F., VOF, C.V. or U.A., like Bakkerij van Dam B.V., or a Stichting and its name; an article or possessive alone, as in De BV or Mijn BV, is no name.
rre.nl.company_name(text)
\bStichting(?: (?:(?:van|voor|de|der|het|tot|en|&) ){0,3}[A-Z0-9][\w&'-]{0,30}){1,6}|\b(?!(?:De|Het|Een|Die|Deze|Dit|Dat|Mijn|Uw|Zijn|Haar|Onze|Hun|Elke|Geen) [A-Z.]+(?![\w-]))(?:(?:[A-Z]\.){1,4}|Gebr\.|[A-Z][\w&'-]{0,30})(?: (?:(?:[A-Z]\.){1,4}|Zn\.|[A-Z0-9][\w&'-]{0,30}|&|van|de|der|den|het)){0,6} (?:B\.V\.|N\.V\.|V\.O\.F\.|v\.o\.f\.|C\.V\.|U\.A\.|BV|NV|VOF)(?![\w-])
kvk_number¶
Dutch Chamber of Commerce number (KvK-nummer): eight digits after KvK, Kamer van Koophandel, handelsregister or CoC, keyword included, like KvK-nummer: 68750110.
rre.nl.kvk_number(text)
(?i:\b(?:kvk|k\.v\.k|kamer van koophandel|handelsregister|chamber of commerce|coc)\b)[^\d\n]{0,20}\d{8}\b
rsin¶
Dutch legal entity number (RSIN, Rechtspersonen en Samenwerkingsverbanden Informatienummer) after the keyword RSIN, keyword included: nine digits, like RSIN: 9999.00.006.
rre.nl.rsin(text)
(?i:\brsin\b)[^\d\n]{0,20}\d(?:[ .-]?\d){8}\b
Matches are checked with nl_bsn; one that fails it is dropped.
vat_number¶
Dutch VAT number (btw-nummer, btw-id): NL, nine digits, B and two digits, also with spaces or dots, like NL999999990B01 or NL 9999.99.999.B.67.
rre.nl.vat_number(text)
\bNL ?\d{4}\.?\d{2}\.?\d{3}[ .]?B[ .]?\d{2}\b
Matches are checked with nl_vat_number; one that fails it is dropped.
Banking and payments¶
| function | checksum validator |
|---|---|
rre.nl.bic |
|
rre.nl.iban |
iban |
rre.nl.tikkie_link |
bic¶
BIC (SWIFT code) of a Dutch bank: four letters, NL and two letters or digits, with an optional three-character branch code, like ABNANL2A or RABONL2UXXX.
rre.nl.bic(text)
\b[A-Z]{4}NL[A-Z0-9]{2}(?:[A-Z0-9]{3})?\b
iban¶
Dutch IBAN: NL, two check digits, a four-letter bank code and ten digits, with or without spaces, like NL91 ABNA 0417 1643 00.
rre.nl.iban(text)
\bNL\d{2} ?[A-Z]{4}(?: ?\d{4}){2} ?\d{2}\b
Matches are checked with iban; one that fails it is dropped.
tikkie_link¶
Tikkie payment request link (betaalverzoek): tikkie.me/pay/ and the request code, with or without https:// or www., in any case, like https://tikkie.me/pay/AbCd1234EfGh5678; not inside another domain or path.
rre.nl.tikkie_link(text)
(?<![\w./-])(?i:(?:https?://)?(?:www\.)?tikkie\.me/pay/)[A-Za-z0-9]+(?:/[A-Za-z0-9]+)?
Phones and SIM cards¶
| function | checksum validator |
|---|---|
rre.nl.iccid |
luhn |
rre.nl.imsi |
|
rre.nl.mobile_number |
phone |
rre.nl.msisdn |
phone |
rre.nl.phone_number |
phone |
rre.nl.premium_number |
phone |
iccid¶
SIM card number (ICCID) of a Dutch SIM: 8931 followed by 14 to 16 digits, without spaces, like 89310412345678901230.
rre.nl.iccid(text)
\b8931\d{14,16}\b
Matches are checked with luhn; one that fails it is dropped.
imsi¶
IMSI (subscriber identity on a SIM) of a Dutch network: mobile country code 204 and 12 more digits, 15 in all, like 204041234567890.
rre.nl.imsi(text)
\b204\d{12}\b
mobile_number¶
Dutch mobile number (06-nummer): 06, (06), +31 6, (+31) 6, 0031 6 or +31 (0)6 and eight digits, with spaces or dashes, like 06-12345678; only valid Dutch mobile numbers.
rre.nl.mobile_number(text)
(?:(?:\(\+31\)|(?:\+|\b00)31)[ -]?(?:\(0\)[ -]?)?|(?<!\d )(?<!\b[A-Z]{4} )\b0)6[ -]?[1-58](?:[ -]?\d){7}\b(?![.:-]\d)|\(06\)[ -]?[1-58](?:[ -]?\d){7}\b(?![.:-]\d)
Matches are checked with phone (regions NL, kind mobile); one that fails it is dropped.
msisdn¶
Dutch mobile number in MSISDN form, as in telecom records: 31 and the number without its 0, 11 digits like 31612345678, not after a +; only valid Dutch mobile numbers.
rre.nl.msisdn(text)
(?<!\+)\b316[1-58]\d{7}\b
Matches are checked with phone (regions NL, kind msisdn); one that fails it is dropped.
phone_number¶
Dutch phone number (telefoonnummer): ten digits, landline or 06 mobile, national or with +31, (+31), 0031 or +31 (0), with spaces or dashes, like 010 123 4567, or the area code in brackets, like (010) 123 4567; only valid Dutch numbers.
rre.nl.phone_number(text)
(?:(?:\(\+31\)|(?:\+|\b00)31)[ -]?(?:\(0\)[ -]?)?|(?<!\d )(?<!\b[A-Z]{4} )\b0)(?:[1-357-9]\d|4(?=[0356]|1[1-368]|7[58]|8[15-8]|9[23579])\d|6[ -]?[1-58])(?:[ -]?\d){7}\b(?![.:-]\d)|\(0(?:[1-57]\d\d?|8\d|6(?=\)[ -]?[1-58]))\)[ -]?\d(?:[ -]?\d){5,7}\b(?![.:-]\d)
Matches are checked with phone (regions NL); one that fails it is dropped.
premium_number¶
Dutch premium-rate number (0900-nummer): 0900, 0906 or 0909 and four or seven digits, with spaces or dashes, like 0906 1234 or 0900-123 4567; only valid Dutch numbers.
rre.nl.premium_number(text)
(?<!\d )\b090[069](?:[ -]?\d){4}(?:(?:[ -]?\d){3})?\b
Matches are checked with phone (regions NL, kind premium); one that fails it is dropped.
Places and addresses¶
| function | checksum validator |
|---|---|
rre.nl.postal_code |
|
rre.nl.street_address |
postal_code¶
Dutch postal code (postcode): four digits and two letters, with or without a space, like 1234 AB or 9999ZZ; SA, SD and SS are never used, KB, MB, GB and TB are left out, and so is a compound like 2024 EU-breed.
rre.nl.postal_code(text)
\b[1-9]\d{3} ?(?!S[ADS]|[KMGT]B)[A-Z]{2}\b(?!-\w)
street_address¶
Dutch street address (adres): a name ending in straat, laan, weg, gracht, kade, plein, singel, dijk or the like (also in capitals), or Laan van and a name, and the house number with addition, like Dorpsstraat 12A or Molenkade 3-II.
rre.nl.street_address(text)
\b(?!Onderweg )(?:[A-Z][\w'-]{0,40}?(?:straat|str\.?|laan|weg|gracht|kade|plein|singel|dijk|dreef|steeg|markt|hof|park|plantsoen|wal|haven|baan)|[A-Z]{2}[A-Z'-]{0,39}?(?:STRAAT|STR\.?|LAAN|WEG|GRACHT|KADE|PLEIN|SINGEL|DIJK|DREEF|STEEG|MARKT|HOF|PARK|PLANTSOEN|WAL|HAVEN|BAAN)|Laan (?:van|der|op|ten|ter)(?: [A-Z][\w'-]*){1,3}) [1-9]\d{0,4}(?:[A-Za-z]|\s?(?:hs|bis|I{1,3}|IV)|-\w{1,4})?\b
Vehicles, ships and parcels¶
| function | checksum validator |
|---|---|
rre.nl.aircraft_registration |
|
rre.nl.license_plate |
|
rre.nl.postnl_tracking_number |
aircraft_registration¶
Dutch aircraft registration: PH- and three letters, like PH-XYZ, or the forms for drones (PH-1AB), microlights (PH-1A1) and gliders (PH-1234).
rre.nl.aircraft_registration(text)
\bPH-(?:[A-Z]{3}|[1-9][A-Z][A-Z\d]|[1-9]\d{2,3})\b
license_plate¶
Dutch license plate (kenteken) in all sidecodes, with dashes like AB-12-34, 12-GBB-3 or G-123-BB, or without dashes like GBB12B; the sidecodes with three letters in a group have no vowels.
rre.nl.license_plate(text)
(?<![\w#-])(?:(?=[\dA-BD-PR-Z-]{8}(?![\w-]))(?:(?=[\d-]*[A-Z])(?=[A-Z-]*\d)(?:[A-Z]{2}|\d{2})(?:-(?:[A-Z]{2}|\d{2})){2}|(?=[\dBDFGHJ-NPR-TV-Z-]{8})(?:[A-Z]{1,3}-\d{2,3}-[A-Z]{1,3}|\d{1,3}-[A-Z]{2,3}-\d{1,3}))|(?=[\dBDFGHJ-NPR-TV-Z]{6}(?![\w-]))(?:[A-Z]{1,3}\d{2,3}[A-Z]{1,3}|\d{1,3}[A-Z]{2,3}\d{1,3}|[A-Z]{4}\d{2}|\d{2}[A-Z]{4}))(?![\w-])
postnl_tracking_number¶
PostNL track-and-trace code (3S-code, barcode): 3S, a customer code of 1 to 4 letters and digits, 13 or 15 characters in all, like 3SDEVC903942795; DHL Parcel also issues 3S codes.
rre.nl.postnl_tracking_number(text)
\b3S(?=[A-Z\d]{11}\b|[A-Z\d]{13}\b)[A-Z]{1,4}\d{7,12}\b
Justice and police¶
| function | checksum validator |
|---|---|
rre.nl.ecli |
ecli¶
European Case Law Identifier (ECLI) of a Dutch court ruling (uitspraak): ECLI:NL:, the court, the year and the number, like ECLI:NL:HR:2020:1234.
rre.nl.ecli(text)
\bECLI:NL:[A-Z]+:\d{4}:[A-Z0-9.]*[A-Z0-9]