Detectors
Handelsregister
Detect and validate German commercial register numbers.
Purpose
Use the handelsregister detector for German commercial register numbers (Handelsregister).
Detector Name
handelsregisterSupported Formats
- Court + register type + number:
München HRB 12345 - Register types:
HRA,HRB,PR(Partnerschaftsregister) - Common courts: München, Berlin, Hamburg, Frankfurt, Köln, etc.
Validation Logic
- Match the pattern:
Court RegisterType Number. - Verify the register type is one of
HRA,HRB,PR. - Verify the court name is a known German court.
This detector uses format validation rather than a checksum algorithm.
Python Examples
Explicit Engine (Recommended)
from fastpii import FastPII
from fastpii.countries.de import GermanPack
priority = {"handelsregister": 90, "steuer_id": 100, "email": 70, "name": 50}
engine = FastPII(priority=priority)
engine.register(GermanPack())
result = engine.detect("Handelsregister: München HRB 12345", detector_names=["handelsregister"])Convenience API
from fastpii import PrivacyGuard
guard = PrivacyGuard(regions=["de"])
result = guard.validate("München HRB 12345", "handelsregister")
print(result.is_valid)Convenience API — Detect in free text
from fastpii import PrivacyGuard
guard = PrivacyGuard(regions=["de"])
result = guard.detect("Handelsregister: München HRB 12345")
for finding in result.findings:
print(finding.type, finding.value)Limitations
- Handelsregister numbers are format-validated, not checksum-validated.
- The court name list may not cover all German Amtsgerichte.
- Some companies use abbreviated court names that may not match.