From a9b3b6ab6e178859d423e1e40893640867a06651 Mon Sep 17 00:00:00 2001 From: jichao wang Date: Thu, 2 Jul 2026 02:03:58 +0100 Subject: [PATCH] Correct de_fuehrerschein docstring to match the actual pattern scope MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The class docstring gives "B0" (Berlin) as an example of a Behördenkürzel and lists `B012345678A` in the Examples line, but the regex `[A-Z]{2}\d{8}[A-Z0-9]` requires both leading characters to be letters, so `B012345678A` never matches. The test file's docstring is the authoritative one — it explicitly notes that single-letter Kfz codes are used in 2-letter authority forms (e.g. `BO`, `KN`) and that `B0`-style single-letter-plus-digit combinations are out of scope, and `test_when_all_de_fuehrerschein_numbers_then_succeed` asserts `B12345678A` is rejected. Update the class docstring to match the tests: replace the `"B0" Berlin` example with `"BO" Bochum`, add a short clarification about single-letter Kfz codes, and change the misleading `B012345678A` Examples entry to `BO12345678A`. --- .../germany/de_fuehrerschein_recognizer.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/germany/de_fuehrerschein_recognizer.py b/presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/germany/de_fuehrerschein_recognizer.py index 15d3ca6fde..1d65f8a474 100644 --- a/presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/germany/de_fuehrerschein_recognizer.py +++ b/presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/germany/de_fuehrerschein_recognizer.py @@ -13,9 +13,13 @@ class DeFuehrerscheinRecognizer(PatternRecognizer): via FeV reform), the number follows a fixed 11-character structure: Pos 1–2: Behördenkürzel – 2 uppercase letters identifying the issuing - Fahrerlaubnisbehörde (derived from the Kfz-Zulassungskürzel of - the issuing Kreis/Stadt, e.g. "B0" Berlin, "MU" München, - "HH" Hamburg, "KO" Koblenz) + Fahrerlaubnisbehörde (derived from the Kfz-Zulassungskürzel + of the issuing Kreis/Stadt, e.g. "MU" München, "HH" Hamburg, + "KO" Koblenz, "BO" Bochum). Single-letter Kfz codes such + as "B" (Berlin) or "K" (Köln) are used in combination as + 2-letter authority codes here (e.g. "BO", "KN"); pure + single-letter + digit forms like "B0" are out of scope for + this strict pattern (see tests/test_de_fuehrerschein_recognizer.py). Pos 3–5: Behördennummer – 3-digit authority code within the Bundesland (assigned by the Kraftfahrt-Bundesamt, KBA) Pos 6–10: Laufende Nummer – 5-digit sequential issue number @@ -27,7 +31,7 @@ class DeFuehrerscheinRecognizer(PatternRecognizer): EU standard: Annex I to Directive 2006/126/EC (Field 5). Data protection: DSGVO Art. 4 Nr. 1 (personenbezogene Daten), BDSG. - Examples (fictitious): B012345678A, MU12345678B, HH98765432C + Examples (fictitious): BO12345678A, MU12345678B, HH98765432C Scope note: Pre-2013 German driving licenses (pink folded card, laminated card) used locally defined, non-standardized number formats and remain