हर developer जिसने European customers के लिए address form build किया है उसे eventually सच पता चलता है: कोई European postal code format नहीं है। हर देश का अपना है, और variations genuinely meaningful हैं। यह page EU-27 plus key non-EU European countries का country-by-country reference है, regex patterns और validation tips के साथ जो आपको production में चाहिए।
High-Level Pattern
European postal codes roughly चार groups में split होते हैं:
- 5-digit numeric: Germany, France, Italy, Spain, Finland, Croatia, Estonia, Greece, Lithuania, Slovakia।
- 4-digit numeric: Belgium, Bulgaria, Hungary, Austria, Switzerland, Liechtenstein, Luxembourg, Norway, Slovenia, Denmark।
- Alphanumeric, fixed format: Netherlands (4 digits plus 2 letters), Ireland (Eircode, 7 alphanumeric), Malta (3 letters plus 4 digits)।
- Hierarchical alphanumeric: United Kingdom (variable-length, two-part)।
Plus कुछ outliers: Sweden तीसरे के बाद space के साथ 5 digits use करता है (123 45), Poland दूसरे के बाद hyphen के साथ 5 digits (00-001), Czechia तीसरे के बाद space के साथ 5 digits (110 00)।
EU-27 Reference
| Country | ISO | Format | Example | Regex |
|---|---|---|---|---|
| Austria | AT | 4 digits | 1010 | ^\d{4}$ |
| Belgium | BE | 4 digits | 1000 | ^\d{4}$ |
| Bulgaria | BG | 4 digits | 1000 | ^\d{4}$ |
| Croatia | HR | 5 digits | 10000 | ^\d{5}$ |
| Cyprus | CY | 4 digits | 1010 | ^\d{4}$ |
| Czechia | CZ | NNN NN | 110 00 | ^\d{3} ?\d{2}$ |
| Denmark | DK | 4 digits | 1050 | ^\d{4}$ |
| Estonia | EE | 5 digits | 10111 | ^\d{5}$ |
| Finland | FI | 5 digits | 00100 | ^\d{5}$ |
| France | FR | 5 digits | 75008 | ^\d{5}$ |
| Germany | DE | 5 digits | 10115 | ^\d{5}$ |
| Greece | GR | NNN NN | 105 63 | ^\d{3} ?\d{2}$ |
| Hungary | HU | 4 digits | 1051 | ^\d{4}$ |
| Ireland | IE | Eircode | D02 X285 | ^[A-Z]\d{2} ?[A-Z0-9]{4}$ |
| Italy | IT | 5 digits | 00184 | ^\d{5}$ |
| Latvia | LV | LV-NNNN | LV-1050 | ^LV-\d{4}$ |
| Lithuania | LT | LT-NNNNN | LT-01100 | ^LT-\d{5}$ |
| Luxembourg | LU | 4 digits | 1234 | ^\d{4}$ |
| Malta | MT | LLL NNNN | VLT 1234 | ^[A-Z]{3} ?\d{4}$ |
| Netherlands | NL | NNNN LL | 1011 AB | ^\d{4} ?[A-Z]{2}$ |
| Poland | PL | NN-NNN | 00-001 | ^\d{2}-\d{3}$ |
| Portugal | PT | NNNN-NNN | 1000-001 | ^\d{4}-\d{3}$ |
| Romania | RO | 6 digits | 010001 | ^\d{6}$ |
| Slovakia | SK | NNN NN | 811 01 | ^\d{3} ?\d{2}$ |
| Slovenia | SI | 4 digits | 1000 | ^\d{4}$ |
| Spain | ES | 5 digits | 28013 | ^\d{5}$ |
| Sweden | SE | NNN NN | 111 22 | ^\d{3} ?\d{2}$ |
Key Non-EU European Countries
| Country | ISO | Format | Example | Regex |
|---|---|---|---|---|
| United Kingdom | GB | hierarchical | SW1A 1AA | ^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$ |
| Switzerland | CH | 4 digits | 8001 | ^\d{4}$ |
| Norway | NO | 4 digits | 0150 | ^\d{4}$ |
| Iceland | IS | 3 digits | 101 | ^\d{3}$ |
| Liechtenstein | LI | 4 digits | 9490 | ^\d{4}$ |
UK Postcode विस्तार से
UK system Europe में सबसे information-dense है। SW1A 1AA जैसा code decompose होता है:
SW: postal area (London South West)SW1A: postal district (St James's and Pimlico)SW1A 1: postal sector (कुछ streets)SW1A 1AA: postal unit (specific delivery point, अक्सर एक building)
यह hierarchy का मतलब है UK postcode एक building identify कर सकता है, इसीलिए UK products अक्सर postcode को neighbourhood-level या street-level grouping के proxy के रूप में use करते हैं। लगभग किसी दूसरे देश का postal code system यह नहीं करता।
Production Validation Patterns
Cheapest production approach ऊपर जैसा per-country regex table है, address से country code के आधार पर applied। Country code आ सकती है:
- User ने explicit dropdown से select किया
- User की IP geolocation
- Geocoder result (अधिकतर production geocoders postal code normalize करते हैं और response में country code include करते हैं)
Country जाने बिना postal code validate करने की कोशिश न करें। 4-digit code 12 countries में valid है और कई में invalid।
High-stakes flows के लिए (checkout, KYC, regulated industries), regex पर मत रुकें। Address को geocoder को send करें और "rooftop" या "street" precision response को validation मानें, केवल regex match को नहीं। Correctly formatted postal code फिर भी real address match करने में fail कर सकता है।
Storage और Normalisation
Postal codes को strings के रूप में store करें, numbers के रूप में नहीं। Leading zeros मायने रखते हैं (01100 valid Lithuanian code है; 1100 नहीं है)। Storage format conventions:
- Data sets में compare करते समय non-alphanumeric characters strip करें।
- Output पर country-canonical form में display करें (hyphens, spaces, prefixes के साथ)।
- Postal code के साथ हमेशा country code store करें, भले ही आपका product आज केवल एक country में operate करे। Schema बिना migration के multi-country expansion तक scale होता है।
MapAtlas कैसे Help करता है
MapAtlas Geocoding API हर supported country के लिए normalised address_components.postal_code field return करता है, source data के against validated। Search API postal code को search input के रूप में accept करता है और matching place return करता है। दोनों APIs EU-hosted, GDPR-compliant हैं, और explicit per-country address parsers के साथ OSM-grade data पर built हैं।
Addresses coordinates कैसे बनती हैं इसकी deeper look के लिए, What Is a Geocode देखें। हर coordinate response के पीछे longitude और latitude mechanics के लिए, Longitude vs Latitude देखें।
अक्सर पूछे जाने वाले प्रश्न
European postal codes का format क्या है?
कोई single European postal code format नहीं है। हर देश अपना define करता है। अधिकतर fixed-length numeric code use करते हैं (Germany, France, Italy, Spain में 5 digits; Belgium, Hungary, Austria, Switzerland में 4 digits), लेकिन कई alphanumeric codes use करते हैं (Netherlands 4 digits plus 2 letters, United Kingdom complex two-part alphanumeric system, Ireland Eircode 7 alphanumeric characters use करता है)। एक working address validator को EU-27 plus key non-EU European countries के लिए per-country pattern hold करना होता है।
क्या German postal code (Postleitzahl) Polish postal code जैसा है?
दोनों पाँच characters हैं लेकिन structure अलग है। Germany 5 contiguous digits use करता है (जैसे 10115)। Poland 2 digits, एक hyphen, फिर 3 digits use करता है (जैसे 00-001)। Storage के लिए, Poland के लिए canonical form hyphen के साथ और Germany के लिए बिना hold कर सकते हैं। Data sets में matching के लिए, non-alphanumeric characters strip करके normalize करें और display पर country-specific format re-apply करें।
किसी भी EU country का postal code validate कैसे करें?
पहले country identify करें (address से, ISO 3166-1 alpha-2 country code से, या user की geolocation से)। फिर उस country का regex pattern apply करें। Country-aware validation standard production pattern है, क्योंकि एक single global regex या तो valid codes reject करेगा या clearly invalid ones accept करेगा। MapAtlas Geocoding API `address_components` में per-country normalised postal code return करता है, इसलिए आप आमतौर पर geocoder को validation step करने देते हैं।
United Kingdom postal code system इतना अलग क्यों दिखता है?
UK postcodes hierarchical alphanumeric system use करते हैं जो postal area, district, sector, और unit को दो parts में encode करता है (जैसे Buckingham Palace के लिए SW1A 1AA)। यह per code अधिकतर country systems से ज़्यादा spatial information carry करता है, इसीलिए UK postcodes को neighbourhood या individual streets के proxy के रूप में use किया जाता है। System 1950s और 1960s में designed हुआ और modern data infrastructure में retrofit होता आ रहा है।

