Comment

Avatar

Level 2

06-09-2017

Thanks Jason. The solution we went with was to write a profile script which returns the relevant country depending on the users postcode:

var reScotland = /(AB|DD|DG|EH|FK|G|HS|IV|KA|KW|KY|ML|PA|PH|TD|ZE)\d{1,2}(\s|)\d[A-Z]{2}/i; var reWales = /(CF|CH|GL|HR|LD|LL|NP|SA|SY)\d{1,2}(\s|)\d[A-Z]{2}/i; var reNorthernIreland = /BT\d{1,2}(\s|)\d[A-Z]{2}/i;  if (profile.geolocation.zip) {      if (reScotland.test(profile.geolocation.zip)) {           return 'scotland';      } else if (reWales.test(profile.geolocation.zip)) {           return 'wales';      } else if (reNorthernIreland.test(profile.geolocation.zip)) {           return 'norther ireland';      } else {           return 'england';      } }