Check this out - it works very well. It doesn't only accept the correct format, but also validates it so, for instance, it wouldn't accept XY34 1PG even though it's in the general format that is consistent with a UK postcode. There is no city with the abbreviation XY...