FastPII Docs
Detectors

Handelsregister

Detect and validate German commercial register numbers.

Purpose

Use the handelsregister detector for German commercial register numbers (Handelsregister).

Detector Name

handelsregister

Supported 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

  1. Match the pattern: Court RegisterType Number.
  2. Verify the register type is one of HRA, HRB, PR.
  3. Verify the court name is a known German court.

This detector uses format validation rather than a checksum algorithm.

Python Examples

from fastpii import FastPII, DEFAULT_PRIORITY
from fastpii.countries.de import GermanPack

engine = FastPII(priority=DEFAULT_PRIORITY)
engine.register(GermanPack())
result = engine.detect("Handelsregister: München HRB 12345", detector_names=["handelsregister"])

Validate a value directly

from fastpii import FastPII, DEFAULT_PRIORITY
from fastpii.countries.de import GermanPack

engine = FastPII(priority=DEFAULT_PRIORITY)
engine.register(GermanPack())
result = engine.validate("München HRB 12345", "handelsregister")

print(result.is_valid)

Detect in free text

from fastpii import FastPII, DEFAULT_PRIORITY
from fastpii.countries.de import GermanPack

engine = FastPII(priority=DEFAULT_PRIORITY)
engine.register(GermanPack())
result = engine.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.

On this page