I am looking for official/reliable regexps to extract sector/district/areas from a UK postcode. I have found a few online but I am not sure how good they are, and I have not a way to test them properly. Do you know any of those regex that can be considered valid?
Where I can find a good regexp to extract sector, district and area from a UK postcode?
This matches, in order:
- Unit Postcode
- Postcode Sector
- Postcode District
- Postcode Area
I have a page on my website which addresses postcode format and using regular expressions to parse a post code into it's constituent parts.
I am using exactly the same regexp at the moment, that I got from another website Sep 27, 2018 at 10:30