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
4
votes
5 answers

Javascript UK postcode regex

I have a javascript regex which validates UK postcodes. It works well, but it doesn't take into account that some people write it with spaces in the middle and others don't. I've tried to add this but cant work it out :S UK postcodes are mainly 2…
Phil Young
  • 1,334
  • 3
  • 21
  • 43
4
votes
2 answers

How to find postcode by latitude and longitude for UK

I am working on a android app in which i came across a situation in which i need to get the current user postcode, so i am getting the current latitude and longitude but is there any way to find the current postcode by providing latitude and…
kami998
  • 91
  • 2
  • 11
3
votes
2 answers

How to set the initial map area in OpenLayers?

I'm using Patrick Wied's OpenLayers Heatmap layer, but only for locations in the UK. How can I preset the initial map display area to show just the UK? Here's the code I've used in an ASPX page var map, layer, heatmap; function init() { var…
Keith MacDonald
  • 218
  • 2
  • 7
3
votes
7 answers

Formatting UK postal codes for storage

I want to store UK postal codes in the database. Is it OK to store those postal codes without the spaces?
marcin_koss
  • 5,763
  • 10
  • 46
  • 65
3
votes
7 answers

Finding full address from postcode, what is the solution?

Basically I am making an application form for my site. I need to search for a full address using the user input postcode and would like to offer the results of that postcode for them to choose. I am aware that a database of sorts will be required…
Matt Ginn
  • 294
  • 1
  • 2
  • 10
3
votes
1 answer

Whats the best way to store and retrive postal addresses using a sql server database and the .NET framework?

I'm looking for a common pattern that will store and access global addresses in database. Components or other technologies can be used. The following criteria must be adheard to... Every line of the address is saved for every country Postal codes…
digiguru
  • 12,724
  • 20
  • 61
  • 87
3
votes
1 answer

How to prevent postcode/zip field from getting hidden for some countries in WooCommerce

I want to show postcode/zip field even for the countries that do not use postcodes/zip on WooCommerce checkout page. WooCommerce hides postcode/zip field by default for countries that don't use them. I have used following filter in theme…
aliencity
  • 83
  • 2
  • 12
3
votes
1 answer

Best API to retrieve zip code by user input city name (US only)?

I have a city name field I am getting value from (i.e. randomly formatted), such as "NEW YORK", "new york" or "new-york" or "ny". Having that field's value, I need to present user with a list of cities that have that value in their name in this…
Misha Reyzlin
  • 13,736
  • 4
  • 54
  • 63
3
votes
3 answers

Split UK postcode into two main parts using java

This regular expression for validating postcodes works perfect ^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) {0,1}[0-9][A-Za-z]{2})$ but I want…
Farouk Alhassan
  • 3,780
  • 9
  • 51
  • 74
3
votes
2 answers

Regex to extract inconsistent postal codes from string

Using the solution posted here, I'm looking to extract postal codes from a list of irregular data in Excel. Below is a sample of what my data looks like: Brampton L6P 2G9 ON Canada M5B2R3 Toronto ON Toronto M5J 0A6 ON Canada M1H1T7 Canada Toronto…
Jennifer E
  • 31
  • 4
3
votes
2 answers

How can I get a list of postcodes (GB) given a postcode (or coordinates) and a radius?

There are plenty of articles on this subject but I couldn't find any that suits my needs. The only thing I need is to get a list of postcodes within a x miles radius of another postcode. I don't have a postcode database and although there is a free…
Fabio
  • 791
  • 1
  • 7
  • 27
3
votes
4 answers

R - Inserting variable number of spaces into postcode string

I have a set of UK postcodes which need to be reformatted. They are made up of an incode and an outcode, where incode is of the form 'number letter letter' e.g. 2DB and the outcode is a combination of between 2 and 4 letters and numbers e.g. NW1 or…
lapsel
  • 75
  • 5
3
votes
3 answers

Using Python, how can I validate a UK postcode?

I have a number of UK postcodes. However, they are not well formatted. Sometimes, they look normal postcodes such as SW5 2RT, sometimes they don't have the space in the middle, but still valid such as SW52RT. But in some cases, they are wrong due to…
ChangeMyName
  • 7,018
  • 14
  • 56
  • 93
3
votes
3 answers

format string (postcode) in ruby

I need to re-format a list of UK postcodes and have started with the following to strip whitespace and capitalize: postcode.upcase.gsub(/\s/,'') I now need to change the postcode so the new postcode will be in a format that will match the following…
noddy
  • 33
  • 3
3
votes
1 answer

Prestashop: payment method depending on postcode

I'm new to prestashop and I need to know if there is a way (via code) by which I can restrict the number of payment gateways available according to customer postcode. For example, let's say that anyone who buys from New York can only pay via PayPal…
Leonardo Lanchas
  • 1,616
  • 1
  • 15
  • 37