UK postcodes are broken down/divided into 4 levels: Areas, Districts, Sectors, and Units.
RegEX for filtering can be found in this post: UK Postcode Breakdown RegEX.
For G12 8QH the breakdown is:
Area – G
District – G12
Sector – G12 8
Unit – G12 8QH