There are two levels of validation. At it's simplest, you just need to check that the code is 4 digits a space and then 2 letters; obviously that's trivial. But that only checks that it's a potential postcode. To check that it is a valid postcode you would have to check it against a database sucah as this one.
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this
site. Computing.Net and Purch hereby disclaim all responsibility
and liability for the content of Computing.Net and its accuracy.