"id";"title";"slug";"url";"type";"description";"remote_url";"organization";"organization_id";"image";"featured";"created_at";"last_modified";"tags";"datasets";"metric.discussions";"metric.datasets";"metric.followers";"metric.views"
"63e1fafb7e50e35ed4c626d3";"Validate ZIP Codes with Regular Expressions";"validate-zip-codes-with-regular-expressions";"https://data.public.lu/fr/reuses/validate-zip-codes-with-regular-expressions/";"api";"### Validate ZIP Codes with Regular Expressions
A Library of JavaScript Regular Expressions for validating if a specific Zip-code exists in a specific Country.
Not every 5 digit number is automatically a zip code... As of now Regular Expression seem to be the fastest way of validating if a zip code actually exists. No slow backend validation needed, just some fancy RegExp.
So Why val-zip? Because it is free for commercial use and it is super fast and light weight with only 448kB size. As of now the Regular Expressions for Germany, Austria, Switzerland, USA (5-Digit version), Belgium, Denmark, Czechia, Finland, Norway, Italy, Spain, Estonia, Iceland, France, Luxembourg are available with more coming asap.
## Usage
Download via Node Package Manager (NPM):
```shell
npm install val-zip
```
Import via Content Delivery Network (CDN):
```html
```
Note: CDN is still wip, so error may occur. In doubt use skypack cdn
## Example
```javascript
import valZip from ""val-zip""; // make sure to use type=""module"" or the "".mjs"" file extension
// alternative: const valZip = require(""val-zip"");
// note: the require function is nodejs specific and is not available in a ESM or Browser environment.
// make sure to use type=""commonjs"" or the "".cjs"" file extension
// let's say a random user puts in a zipcode somehow and you want to validate if the zip code exists.
var userCountry = ""US""; // ISO 3166 Country Code; string
var inputZip_1 = ""12345""; // fake, this zipcode does NOT exist in the United States
var inputZip_2 = ""00601""; // reak, exists
valZip(inputZip_1, userCountry) // returns false
valZip(inputZip_2, userCountry) // returns true
```
## Zip Code Sources
Note: All data is heavily modified and does not resemble the original data base at all
| country | last update | license | source |
| ------------- | ----------- | :---------------------------------------------------------: | ---------------------------------------------------------------------- |
| Austria | 04.01.2023 | none | Österreichische Post Aktiengesellschaft |
| Belgium | 21.11.2021 | none | Bpost |
| Switzerland | 01.01.2023 | [CC-BY](https://creativecommons.org/licenses/by/4.0/legalcode) | Die Schweizerische Post |
| Czechia | 01.01.2023 | none | Česká pošta |
| Germany | 01.06.2019 | none | Launix |
| Denmark | 22.06.2022 | none | PostNord Danmark |
| United States | 31.12.2020 | none | Internal Revenue Service, US Census |
| Norway | 01.10.2022 | none | Osten Norge AS |
| Finland | 30.01.2023 | none | Posti Group Oy |
| Italy | 26.11.2020 | Eurostat free re-use of data | Eurostat |
| Spain | 26.11.2020 | Eurostat free re-use of data | Eurostat |
| Estonia | 05.02.2023 | none | Republic of Estonia |
| Iceland | 06.02.2023 | none | Íslandspóstur |
| France | 06.02.2023 | Open License v2.0 | [La Poste Groupe](https://www.lapostegroupe.com/fr) |
| Luxembourg | 06.02.2023 | CC-0 | Portail Open Data |
Some Countries are missing, just because the official zipcode database is either paywalled or entirely copyrighted.
This is the List of countries I am unable to source data from:
| country | limitation | source |
| --------- | ---------------- | ------------------------------ |
| Poland | only with permit | Poczta Polska Spółka Akcyjna |
| Sweden | paid only | Postnummerservice Norden AB |
| Australia | paid only | Australia Post |
MIT License
Copyright (c) 2022-today Leonhard Maier
";"https://www.npmjs.com/package/val-zip";"";"";"https://download.data.public.lu/images/38/ac065e998b4720a30a57c48cf96405-500.png";False;"2023-02-07T08:17:15.593000";"2024-03-28T00:50:33.330000";"address-validation,api,austria,belgium,code-postal,codes-postaux,czechia,denmark,estonia,finland,france,geojson,iceland,italy,javascript,json,luxembourg,nodejs,norway,npm,postal-codes,postcode,regex,regular-expression,spain,switzerland,tool,validation,validator,vuejs,web,website,zip-codes,zipcode";"56fd16fa855e9b6a1088f552";0;1;0;81
"62b565e12780976b7b30da85";"Inondations.lu widget shown in geoportail";"inondations-lu-widget-shown-in-geoportail";"https://data.public.lu/fr/reuses/inondations-lu-widget-shown-in-geoportail/";"visualization";"The live water levels are shown on the layer on the geoportail.lu website.";"https://g-o.lu/3/Qwi0";"Administration de la gestion de l'eau";"571dcf8d32cc221e8ffea95a";"";False;"2022-06-24T09:21:05.121000";"2024-03-28T00:50:33.197000";"api,flood,visualisation,water-levels";"59c220a4111e9b1de61d8864";0;1;0;62
"5b7d30a188d0b263038f5025";"LuxAdr Service";"luxadr-service";"https://data.public.lu/fr/reuses/luxadr-service/";"application";"LuxAdr provides a state of the art API to access data related to all official addresses of Luxembourg. The data structure is closely related to the official data provided by data.public.lu and can be kept up to date with ease. Among others you will have access to all:
- Localities
- Postcodes
- Streets
- House numbers (Buildings)
Location data of the buildings (latitude, longitude)
Several search features are included and designed to be used, among others, from web pages. You will also have the possibility to search via location data. Additionally once imported, data will never be deleted, only deactivated, so if you make a reference to an id it will be always be available for later use.";"https://github.com/dainesch/LuxAdr";"";"";"";False;"2018-08-22T11:45:05.003000";"2024-03-29T00:50:26.151000";"addresses,api,geodata,java,service";"56fd152d0d6ceb6744b6f9f2,56fd16fa855e9b6a1088f552";0;2;0;55
"577e4d4432cc2238548879b8";"Transitfeeds";"transitfeeds-1";"https://data.public.lu/fr/reuses/transitfeeds-1/";"api";"Transitfeeds enables the visualisation and exploration of the GTFS feed for Luxembourg.";"https://transitfeeds.com/p/openov/621";"";"";"";True;"2016-07-07T14:38:28.087000";"2024-03-18T00:50:08.311000";"api,bus,train,transport,transport-public,transports-en-commun";"56fbd4e5855e9b6a1088f54e";0;1;1;7