Questions tagged [postal-code]

A postal code is a series of letters and/or digits which is useful to identify the a particular region within a postal address. Once postal codes were introduced, other applications became possible.

A postal code is a series of letters and/or digits which is useful to identify the a particular region within a postal address. Once postal codes were introduced, other applications became possible.

In February 2005, 117 of the 190 member countries of the Universal Postal Union had postal code systems. Countries that do not have national systems include Ireland and Panama. Although Hong Kong and Macau are now Special Administrative Regions of China, each maintains its own long-established postal system, which does not utilize postal codes for domestic mail, and no postal codes are assigned to Hong Kong and Macau. Mail between Hong Kong, Macau and mainland China is treated as international.

399 questions
251
votes
20 answers

What is the ultimate postal code and zip regex?

I'm looking for the ultimate postal code and zip code regex. I'm looking for something that will cover most (hopefully all) of the world.
Darryl Hein
  • 142,451
  • 95
  • 218
  • 261
239
votes
33 answers

RegEx for matching UK Postcodes

I'm after a regex that will validate a full complex UK postcode only within an input string. All of the uncommon postcode forms must be covered as well as the usual. For instance: Matches CW3 9SS SE5 0EG SE50EG se5 0eg WC2H 7LT No Match aWC2H…
Kieran Benton
  • 8,739
  • 12
  • 53
  • 77
140
votes
12 answers

Is there common street addresses database design for all addresses of the world?

I am a programmer and need a practical approach to storing street address structures of the world in a database. So which is the best and common database design for storing street addresses? It should be simple to use, fast to query and dynamic to…
Arsen Mkrtchyan
  • 49,896
  • 32
  • 148
  • 184
129
votes
15 answers

Best practices for storing postal addresses in a database (RDBMS)?

Are there any good references for best practices for storing postal addresses in an RDBMS? It seems there are lots of tradeoffs that can be made and lots of pros and cons to each to be evaluated -- surely this has been done time and time again? …
John
  • 14,944
  • 12
  • 57
  • 57
121
votes
8 answers

I need to store postal codes in a database. How big should the column be?

I expect the column to be a VARCHAR2, in my Oracle Database. US Zips are 9. Canadian is 7. I am thinking 32 characters would be reasonable upper limit What am I missing? [EDIT] TIL: 12 is a reasonable answer to the question Thanks to everyone who…
EvilTeach
  • 28,120
  • 21
  • 85
  • 141
79
votes
10 answers

Address validation using Google Maps API

I have a task to validate addresses entered into a system I am currently creating. The system requires that address entered are validated against a valid data source. In the UK the dataset comes from the Royal Mail and is expensive to access. The…
Paul
  • 1,815
  • 5
  • 27
  • 44
62
votes
12 answers

Is it a good idea to use an integer column for storing US ZIP codes in a database?

From first glance, it would appear I have two basic choices for storing ZIP codes in a database table: Text (probably most common), i.e. char(5) or varchar(9) to support +4 extension Numeric, i.e. 32-bit integer Both would satisfy the requirements…
Sean Hanley
  • 5,677
  • 7
  • 42
  • 53
34
votes
6 answers

Where can I get postal codes for all countries?

I once read about an open source database for postal codes with geolocation data but now I can't remember its name. Can someone help?
suhair
  • 10,895
  • 11
  • 52
  • 63
25
votes
6 answers

Get city name and postal code from Google Place API on Android

I'm using Google Place API for Android with autocomplete Everything works fine, but when I get the result as shown here, I don't have the city and postal code information. private ResultCallback mUpdatePlaceDetailsCallback =…
Plumillon Forge
  • 1,659
  • 1
  • 16
  • 31
23
votes
23 answers

Retrieving Postal Code with Google Maps Javascript API V3 Reverse Geocode

I'm trying to submit a query using the postal code to my DB whenever the googlemaps viewport center changes. I know that this can be done with reverse geocoding with something like: google.maps.event.addListener(map, 'center_changed',…
23
votes
8 answers

Where can I find a list of all UK _full_ postcodes including street name and their precise coordinates?

Where can I find a list of all UK full postcodes including street name and their precise coordinates? They should be not like AB1, AB23 etc but AB1 2AA, AB23 5ZZ etc. Preferably for free :) Thanks
ORA600
18
votes
1 answer

How to create Stripe elements postal code that accepts UK postcodes?

I'm creating a payment form with separate Stripe Elements: var stripe = Stripe(...); var elements = stripe.elements(); ... var postalCode = elements.create('postalCode'); postalCode.mount('#postalCode'); This creates a field that accepts only…
Vedran Šego
  • 3,553
  • 3
  • 27
  • 40
16
votes
5 answers

How to convert postal code to city name, is there an API available?

How to convert post code to city name, is there an API available?
Ling
  • 269
  • 1
  • 3
  • 15
13
votes
8 answers

United Kingdom (GB) postal code validation without regex

I have tried several regexes and still some valid postal codes sometimes get rejected. Searching the internet, Wikipedia and SO, I could only find regex validation solutions. Is there a validation method which does not use regex? In any language, I…
oxygen
  • 5,891
  • 6
  • 37
  • 69
13
votes
8 answers

Validate Canadian Postal Code using regex

I have written a JavaScript to validate Canadian Postal Codes using regex. However, it does not seem to be working: JavaScript If statement: if (myform.zip.value == "" || myform.zip.value == null || myform.zip.value == "Postal Code" ||…
Alex Block
  • 315
  • 1
  • 4
  • 15
1
2 3
26 27