Dutch (NL) postal code regex matches invalid values
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- internationalization
Research direction
Start with the Dutch postal-code validation data or entry point in libaddressinput and compare its regex with the issue's current and proposed patterns. Review the regex101 unit tests linked in the report, then verify that zero-prefixed codes and the SA, SD, and SS suffixes are rejected while valid Dutch codes remain accepted.
Written by the indexing model from the issue text.
Description
Hello there,
Following a discussion at work, I looked into a package used for postal code validation (axlon/postal-code-validation), which is seeding data from the Google Address Data Service (as pointed out in axlon/postal-code-validation#27).
After a short discussion, @wotta pointed out that the regex used is invalid. The regex (\d{4} ?[A-Z]{2}) allows the following invalid postal codes:
0123 AB, which are invalid since all our postal codes start with 1-9.1111 SA,1111 SDand1111 SS, which are banned due to theSA,SD, andSSabbreviations which were used in the Second World War source.
A better regex for Dutch postal codes would be [1-9]\d{3} ?(?!SA|SD|SS)[A-Z]{2}, which explicitly excludes zero-based postal codes and invalid suffixes.
I made some tests on regex101.com (click on "Unit Tests" in the left sidebar).
- Dominant language
- C++
- Stars
- 629
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/libaddressinput
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
google/libaddressinput#255 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
google/libaddressinput#245 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
google/libaddressinput#254 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 52/100
google/libaddressinput#250 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
google/libaddressinput#249 ·
All issues in google/libaddressinput
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
lldb
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
llvm/llvm-project#229592 · 11 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
llvm/offload-test-suite#1560 ·
Maintainers usually reply within 1 day
-
cudf-polars feature request
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day