Test, validate and match regular expressions
Matches simplified UK postcodes: an outward code of 1-2 letters followed by 1-2 digits, optionally followed by optional whitespace and an inward code of 1 digit plus 2 letters (e.g., 'M1 1AE', 'DN55 1PT'). Case-insensitive, so lowercase inputs also match. Also accepts incomplete postcodes consisting of only the outward code (e.g., 'SW1'). Note it does not support outward codes ending in a letter, such as 'EC1A 1BB'.