Trying to allow either UK postcode (GF433ED) or European postcode (12345) return true or false but the below code always returns false:
function valid_postcode(postcode) {
postcode = postcode.replace(/\s/g, "");
alert(postcode);
var regex = /^[A-Z]{1,2}[0-9]{1,2} ?[0-9][A-Z]{2}|^[0-9]{5}$/;
return regex.test(postcode);
}
Any help would be greatly appreciated.
Thanks