Luxembourg regexes¶
Python regexes for Luxembourg identifiers, with checksum validation: national number (matricule), TVA, RCS, IBAN, ID card, passport, plates and phones.
20 regexes, from regular_regexes/lu/regexes.json, called as rre.lu.<name>(text).
Personal numbers (1) · Identity documents (4) · Companies and tax (3) · Banking and payments (2) · Phones and SIM cards (5) · Places and addresses (2) · Vehicles, ships and parcels (2) · Justice and police (1)
Personal numbers¶
| function | checksum validator |
|---|---|
rre.lu.national_number |
lu_national_number |
national_number¶
Luxembourg national identification number (matricule): 13 digits starting with the birth date YYYYMMDD, together or grouped like 1983 0819 012 52.
rre.lu.national_number(text)
\b(?:19|20)\d{2}[\s.-]?(?:0\d|1[0-2])[\s.-]?(?:[0-2]\d|3[01])[\s.-]?\d{3}[\s.-]?\d{2}\b
Matches are checked with lu_national_number; one that fails it is dropped.
Identity documents¶
| function | checksum validator |
|---|---|
rre.lu.id_card_number |
|
rre.lu.mrz_id_card |
mrz_td1 |
rre.lu.mrz_passport |
mrz_td3 |
rre.lu.passport_number |
id_card_number¶
Luxembourg identity card number (numéro de la carte d'identité): nine capital letters and digits with at least one of each, like SPEC07347 or 7D9IB9OLK.
rre.lu.id_card_number(text)
\b(?=[A-Z0-9]*\d)(?=[A-Z0-9]*[A-Z])[A-Z0-9]{9}\b
mrz_id_card¶
Machine-readable zone (MRZ) of a Luxembourg identity card, first line (ICAO TD1): 30 characters with LUX as issuing country, like IDLUXSPEC073476210715<<<<<<<<<.
rre.lu.mrz_id_card(text)
(?<![A-Z0-9<])[IAC][A-Z<]LUX[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 Luxembourg passport, second line (ICAO TD3): 44 characters with the passport number, LUX as nationality, date of birth, sex and expiry date.
rre.lu.mrz_passport(text)
(?<![A-Z0-9<])[A-Z0-9<]{9}\dLUX\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.
passport_number¶
Luxembourg passport number (numéro de passeport): seven or eight capital letters and digits with at least one of each, like JC3L7T2H or G2A0312.
rre.lu.passport_number(text)
\b(?=[A-Z0-9]*\d)(?=[A-Z0-9]*[A-Z])[A-Z0-9]{7,8}\b
Companies and tax¶
| function | checksum validator |
|---|---|
rre.lu.company_name |
|
rre.lu.rcs_number |
|
rre.lu.vat_number |
lu_vat_number |
company_name¶
Luxembourg company name with its legal form: S.A., S.à r.l., SARL-S, SAS, SCS, SCSp, SCA, SNC, SE, ASBL, or a fund form (SICAV, SICAF, SICAR, SIF, RAIF, SPF), like Beta Holding S.A. SPF; the name may contain de, du, la or d', and never starts with an article such as La SARL.
rre.lu.company_name(text)
\b(?!(?:Le|La|Les|Une?|Cette|Ce[st]?|Sa|Son|Notre|Votre|Leur|The|Die|Der|Das|Eine?)\s)(?=[A-Z])(?:(?:(?:d[eu]|des|la|les?)\s|[dl]['’])*(?:[A-Z0-9]\w*(?:[.&'’-]\w+){0,3}\.?|&)\s){1,6}(?:S\.?\s?[AàaÀ]\.?\s?[Rr]\.?\s?[Ll]\.?(?:-S)?|S(?:\.\s?)?A\.?(?:S\.?)?|S\.?C\.?(?:Sp?|A)\.?|S\.?e\.?n\.?c\.?|SNC|SCI|SE|A\.?S\.?B\.?L\.?|a\.s\.b\.l\.|SICA[VFR]|SIF|RAIF|SPF)(?:[\s-](?:SICA[VFR]|SIF|RAIF|SPF)){0,2}(?!\w)
rcs_number¶
Luxembourg trade and companies register number (RCS) after RCS, R.C.S. or Registre de commerce et des sociétés, keyword included, also with Luxembourg (or Lux.) or Diekirch: a section letter and digits, like R.C.S. Luxembourg B 123.456.
rre.lu.rcs_number(text)
\b(?:R\.?\s?C\.?\s?S\.?|[Rr]egistre de [Cc]ommerce et des [Ss]oci[ée]t[ée]s|Trade and Companies Register)(?:\s(?:de\s)?(?:Lux(?:embourg|\.)?|Diekirch))?(?:,?\s(?:sous le\s|under\s)?(?:n[°o]\.?|num[ée]ro|number))?\s?:?\s?[A-K]\s?(?:\d{1,3}[.\s]\d{3}|\d{3,6})\b(?![.\s]?\d)
vat_number¶
Luxembourg VAT number (numéro de TVA): LU and eight digits, together or grouped 3-3-2, like LU 123 456 13 or LU12345613; not the placeholder LU00000000.
rre.lu.vat_number(text)
\bLU\s?(?!000[\s.]?000)\d{3}[\s.]?\d{3}[\s.]?\d{2}\b
Matches are checked with lu_vat_number; one that fails it is dropped.
Banking and payments¶
| function | checksum validator |
|---|---|
rre.lu.bic |
|
rre.lu.iban |
iban |
bic¶
BIC (SWIFT code) of a Luxembourg bank: four letters, LU and two letters or digits, with an optional three-character branch code, like BCEELULL or BILLLULLXXX.
rre.lu.bic(text)
\b[A-Z]{4}LU[A-Z0-9]{2}(?:[A-Z0-9]{3})?\b
iban¶
Luxembourg IBAN: LU, two check digits and 16 letters or digits, with or without a space every four, like LU28 0019 4006 4475 0000.
rre.lu.iban(text)
\bLU\d{2}(?: ?[A-Z0-9]{4}){4}\b
Matches are checked with iban; one that fails it is dropped.
Phones and SIM cards¶
| function | checksum validator |
|---|---|
rre.lu.iccid |
luhn |
rre.lu.imsi |
|
rre.lu.mobile_number |
phone |
rre.lu.msisdn |
phone |
rre.lu.phone_number |
phone |
iccid¶
SIM card number (ICCID) of a Luxembourg SIM: 89352 followed by 13 to 15 digits, without spaces, like 8935201123456789011.
rre.lu.iccid(text)
\b89352\d{13,15}\b
Matches are checked with luhn; one that fails it is dropped.
imsi¶
IMSI (subscriber identity on a SIM) of a Luxembourg network: mobile country code 270 and 12 more digits, 15 in all, like 270011234567890.
rre.lu.imsi(text)
\b270\d{12}\b
mobile_number¶
Luxembourg mobile number (GSM): nine digits in the mobile ranges such as 621, 661 or 691, with or without +352 or 00352, like 628 123 456; only valid Luxembourg mobile numbers.
rre.lu.mobile_number(text)
(?:(?:\(\+352\)|\+352|\b00352)[\s./-]?|(?<!\d[\s./-])\b)6(?:[25-9]1|[2569]8|5[56]|7[89]|92)(?:[\s./-]?\d){6}\b(?![\s./-]\d)
Matches are checked with phone (regions LU, kind mobile); one that fails it is dropped.
msisdn¶
Luxembourg mobile number in MSISDN form, as in telecom records: 352 and the nine-digit mobile number, like 352628123456, not after a +; only valid Luxembourg mobile numbers.
rre.lu.msisdn(text)
(?<!\+)\b3526(?:[25-9]1|[2569]8|5[56]|7[89]|92)\d{6}\b
Matches are checked with phone (regions LU, kind msisdn); one that fails it is dropped.
phone_number¶
Luxembourg phone number in international form: +352, 00352 or (+352) and 4 to 10 digits, with spaces, dots, slashes or dashes, like +352 27 12 34 56; only valid Luxembourg numbers.
rre.lu.phone_number(text)
(?:\(\+352\)|\+352|\b00352)[\s./-]?[1-9](?:[\s./-]?\d){3,9}\b
Matches are checked with phone (regions LU); one that fails it is dropped.
Places and addresses¶
| function | checksum validator |
|---|---|
rre.lu.postal_code |
|
rre.lu.street_address |
postal_code¶
Luxembourg postal code (code postal) written with its L- prefix and four digits, like L-2449.
rre.lu.postal_code(text)
\bL-[1-9]\d{3}\b
street_address¶
Luxembourg street address: house number and a French street type such as rue, avenue or route and the name, like 12, rue de la Gare, or a Luxembourgish or German name like Kierchestrooss 7.
rre.lu.street_address(text)
\b\d{1,3}[A-Za-z]?(?:-\d{1,3})?,?\s(?:(?i:rue|avenue|boulevard|route|place|allée|chemin|montée|côte|impasse|quai|esplanade)(?:\s(?:[dl]['’])?(?:[A-ZÀ-Ý][\w'’.-]*|de|du|des|la|le|les|aux?|\d{1,2}))*\s(?:[dl]['’])?[A-ZÀ-Ý][\w'’-]*|Grand['-]Rue|[A-ZÀ-Ý]\w*(?:strooss|straße|strasse|gaass|wee|weg|plaz|platz)\b)|\b[A-ZÀ-Ý]\w*(?:strooss|straße|strasse|gaass|wee|weg|plaz|platz)\s\d{1,3}[A-Za-z]?\b
Vehicles, ships and parcels¶
| function | checksum validator |
|---|---|
rre.lu.aircraft_registration |
|
rre.lu.license_plate |
aircraft_registration¶
Luxembourg aircraft registration: LX- and three letters, like LX-ABC, or LX-N and five digits for NATO's AWACS aircraft, like LX-N90442; the hyphen may be left out.
rre.lu.aircraft_registration(text)
\bLX-?(?:[A-Z]{3}|N\d{5})\b
license_plate¶
Luxembourg license plate (plaque d'immatriculation): two letters, without I or O, and four digits, like ZZ 1234 or ZZ1234; not the end of a German plate such as B-ZZ 1234.
rre.lu.license_plate(text)
(?<![A-Z][\s-])\b[A-HJ-NP-Z]{2} ?\d{4}\b
Justice and police¶
| function | checksum validator |
|---|---|
rre.lu.court_case_number |
court_case_number¶
Luxembourg court case number (numéro du rôle) of the district courts (TAL, TAD) and the Court of Appeal (CAL): code, year and five digits, like TAL-2021-01234.
rre.lu.court_case_number(text)
\b(?:CAL|TAL|TAD)-(?:19|20)\d{2}-\d{5}\b