postal-code

Javascript UK postcode regex

南笙酒味 提交于 2019-11-30 21:53:34
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 letters followed by 1 or 2 numbers, optional whitespace & 1 number and 2 letters. Here is my regex which validates postcodes without spaces: [A-PR-UWYZa-pr-uwyz0-9][A-HK-Ya-hk-y0-9][AEHMNPRTVXYaehmnprtvxy0-9]?[ABEHMNPRVWXYabehmnprvwxy0-9]?{1,2}[0-9][ABD-HJLN-UW-Zabd-hjln-uw-z]{2}|(GIRgir){3} 0(Aa){2})$/g Any ideas? Edit I changed the regex as I

UK Postcode Regex [duplicate]

纵然是瞬间 提交于 2019-11-30 20:09:19
This question already has an answer here: RegEx for matching UK Postcodes 30 answers I'm looking to be able to validate UK Postcodes, and ideally, I would like the following cases to pass: W1 W12 WC1 WC1A WC12 W1 6BT W12 6BT WC1 6BT WC1A 6BT WC12 6BT W16BT W126BT WC16BT WC1A6BT WC126BT I have the following regex patterns: ^(GIR 0AA)|(((A[BL]|B[ABDHLNRSTX]?|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]?|F[KY]|G[LUY]?|H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]?|M[EKL]?|N[EGNPRW]?|O[LX]|P[AEHLOR]|R[GHM]|S[AEGKLMNOPRSTY]?|T[ADFNQRSW]|UB|W[ADFNRSV]|YO|ZE)[1-9]?[0-9]|((E|N|NW|SE|SW|W)1|EC[1-4]|WC[12])[A-HJKMNPR

Python, Regular Expression Postcode search

≡放荡痞女 提交于 2019-11-30 18:39:17
问题 I am trying to use regular expressions to find a UK postcode within a string. I have got the regular expression working inside RegexBuddy, see below: \b[A-Z]{1,2}[0-9][A-Z0-9]? [0-9][ABD-HJLNP-UW-Z]{2}\b I have a bunch of addresses and want to grab the postcode from them, example below: 123 Some Road Name Town, City County PA23 6NH How would I go about this in Python? I am aware of the re module for Python but I am struggling to get it working. Cheers Eef 回答1: repeating your address 3 times

Javascript UK postcode regex

假装没事ソ 提交于 2019-11-30 18:26:31
问题 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 letters followed by 1 or 2 numbers, optional whitespace & 1 number and 2 letters. Here is my regex which validates postcodes without spaces: [A-PR-UWYZa-pr-uwyz0-9][A-HK-Ya-hk-y0-9][AEHMNPRTVXYaehmnprtvxy0-9]?[ABEHMNPRVWXYabehmnprvwxy0-9]?{1,2}[0-9]

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

☆樱花仙子☆ 提交于 2019-11-30 17:34:23
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<PlaceBuffer> mUpdatePlaceDetailsCallback = new ResultCallback<PlaceBuffer>() { @Override public void onResult(PlaceBuffer places) { if (!places.getStatus().isSuccess()) { // Request did not complete successfully Log.e(TAG, "Place query did not complete. Error: " + places.getStatus().toString()); return; } // Get the Place object from the buffer. final Place place = places.get(0); // Format details of

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

妖精的绣舞 提交于 2019-11-30 06:52:42
How to convert post code to city name, is there an API available? You need a service that does geocoding . Yahoo's Geocoder API is getting much better results globally. 110021 is the postal code for New Delhi among several other places in the world. This seems to get them all. Google Maps API is another such service but I'm not happy with the geocoded results as I don't get all results back for 110021 . geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'address': '110021'}, function(results, status) { console.log(results); }); Two years later, IMO the Google Maps Geocoding API is the

UK Postcode Regex [duplicate]

余生颓废 提交于 2019-11-30 03:42:44
问题 This question already has answers here : RegEx for matching UK Postcodes (30 answers) Closed 6 years ago . I'm looking to be able to validate UK Postcodes, and ideally, I would like the following cases to pass: W1 W12 WC1 WC1A WC12 W1 6BT W12 6BT WC1 6BT WC1A 6BT WC12 6BT W16BT W126BT WC16BT WC1A6BT WC126BT I have the following regex patterns: ^(GIR 0AA)|(((A[BL]|B[ABDHLNRSTX]?|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]?|F[KY]|G[LUY]?|H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]?|M[EKL]?|N[EGNPRW]?|O[LX]

How to correctly match UK postcodes by prefix?

放肆的年华 提交于 2019-11-29 11:54:32
I have a number of restaurants who all deliver to certain postcode areas in London, for example: EC1 WC1 WC2 W1 When someone searches for a restaurant that delivers to their home, they enter their full postcode. Some people enter the postcode correctly with the space, some of them just enter all letters and numbers attached, without a space separator. To harmonize things, I remove any space in the postcode before attempting a match. So far, I used to match the postcode to the prefixes by just checking if it starts with the prefix in question, but then I realized that this is not foolproof:

United Kingdom (GB) postal code validation without regex

此生再无相见时 提交于 2019-11-29 09:24:08
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 guess it would be easy to port. I supose the easiest would be to compare against a postal code database, yet that would need to be maintained and updated periodically from a reliable source. Edit: To help future visitors and keep you from posting any more regexes, here's a regex which I have tested (as of 2013-04-24) to work for all postal codes in

UK Royal Mail PAF address finder via postcode alternatives? [closed]

人走茶凉 提交于 2019-11-29 08:09:39
We need an address finder (premise level) based on postcode. We have a budget of 40k for this. But I have been assigned to find some cheaper alternatives for Royal mail PAF database. Is Google any good to find premise level address when you send full postcode. Any recommendation over Royal Mail PAF file. Any web services out there for this to accomplish? Please share your knowledge. Cheers, Naren Alex K. We use products from AFD for this, they work well for us. Edit just saw Best way to geocode UK postcode with Google Maps API? on the front page. The base PAF data is the same but a lot of