Skip to content

Luxembourg postal code regex rejects valid L-XXXX postal codes #67

Description

@jcglombard

Hi,
The Luxembourg postal code validation pattern appears to be incorrect because it does not accept valid Luxembourg postal codes in the official L-XXXX format.

For example:

L-8211

is a valid Luxembourg postal code.

The official documentation from POST Luxembourg explicitly shows Luxembourg addresses using the L-XXXX format, for example:

L-1234 DUDELANGE
L-9874 REMICH
L-2998 LUXEMBOURG

The official postal code database also contains 8211 as a valid postal code for Mamer.

Current behavior

The current Luxembourg regex appears to accept only four numeric digits:

^\d{4}$

As a consequence:

8211 ✅
L-8211 ❌

However, L-8211 is a valid representation of a Luxembourg postal code.

Expected behavior

The validator should accept both representations:

8211 ✅
L-8211 ✅

Ideally, the regex should therefore support the optional L- prefix, for example:

^(?:L-)?\d{4}$

If the validator is intended to be case-insensitive, the corresponding implementation could also allow l-8211.

References

Official POST Luxembourg documentation:

POST Luxembourg — Comment bien rédiger une adresse
POST Luxembourg — Codes postaux (édition du 27 octobre 2025)

The official POST Luxembourg address documentation explicitly uses the L-XXXX format, and the official postal-code list identifies 8211 as a valid postal code for Mamer.

Suggested test cases

I would suggest adding at least the following test cases:

8211 → valid
L-8211 → valid
1234 → valid
L-1234 → valid
123 → invalid
12345 → invalid
L1234 → invalid

Thank you for maintaining this package and for considering this correction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions