]> git.openstreetmap.org Git - rails.git/commitdiff
Recognise UK postcodes with a space in the middle.
authorTom Hughes <tom@compton.nu>
Tue, 7 Aug 2007 23:20:25 +0000 (23:20 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 7 Aug 2007 23:20:25 +0000 (23:20 +0000)
app/controllers/geocoder_controller.rb

index 480dc5419b2b5cf9c4e17c0f5eb6c55408eb74df..34a90935e09bfa3f60a99539412e44bfbe8a9883 100644 (file)
@@ -9,7 +9,7 @@ class GeocoderController < ApplicationController
 
     if @query.match(/^\d{5}(-\d{4})?$/)
       @results.push search_us_postcode(@query)
-    elsif @query.match(/(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW]) [0-9][ABD-HJLNP-UW-Z]{2})/i)
+    elsif @query.match(/(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])\s*[0-9][ABD-HJLNP-UW-Z]{2})/i)
       @results.push search_uk_postcode(@query)
     elsif @query.match(/[A-Z]\d[A-Z]\s*\d[A-Z]\d/i)
       @results.push search_ca_postcode(@query)