|Regex options: None|
Postal codes in the U.K. (or postcodes, as they’re called) are composed of five to seven alphanumeric characters separated by a space. The rules covering which characters can appear at particular positions are rather complicated and fraught with exceptions. This regular expression sticks to the basic rules.
British Standard BS7666, available at http://www.govtalk.gov.uk/gdsc/html/frames/PostCode.htm, describes the U.K. postcode rules.