Skip to content

fix(isPostalCode): Update French postal code regex #2479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Rajput-Balram
Copy link
Contributor

This PR updates the regex pattern used for validating French postal codes in the isPostalCode function.

  • Replaces outdated regex (/^\d{2}\s?\d{3}$/) with accurate pattern (/^(?:(?:0[1-9]|[1-8]\d|9[0-5])\d{3}|97[1-46]\d{2})$/)
  • Updates the test fixtures in validators.test.js to ensure accurate testing of French postal code validation.

Fixes #2478

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

@Rajput-Balram
Copy link
Contributor Author

Requesting Review @WikiRik

@rubiin rubiin requested a review from WikiRik November 12, 2024 16:24
@WikiRik WikiRik merged commit c174a1f into validatorjs:master Mar 26, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong regex for french postal code in isPostalCode
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy