FastPII Docs
Detectors

Postal Code (FR)

Detect and validate French postal codes in 5-digit format.

Purpose

Use the postal_code detector (region fr) for French postal codes (code postal).

This detector uses pattern matching with French postal code format validation.

Detector Name

postal_code

Region: fr

Supported Formats

  • DDDDD (5-digit format)

French postal codes range from 01000 to 95999, with Corsica using 20000-20999 and 2A000-2B999.

Usage

from fastpii import FastPII, DEFAULT_PRIORITY
from fastpii.countries.fr import FrenchPack

engine = FastPII(priority=DEFAULT_PRIORITY)
engine.register(FrenchPack())

result = engine.detect("Code postal 75001 Paris")

Validation

result = engine.validate("75001", "postal_code")
# result.is_valid → True

Metadata

  • Region-based format validation
  • Corsica department codes (2A, 2B) recognized

On this page