I need to extract the first part of postcode for search calculation using a database. Any ideas?! I need this to implement a search module in the site, which looks out for some relevant information according to the post code. But the database which I am having for post code, it doesnt have second part of the postcode, only the first part is there. Its for UK postcode. So, any ideas?!
Share
This will not cover 100% of all possible UK postcodes, but will do for like 99.999% or so 🙂
Test data:
Results:
Please note: It is your responsibility to provide valid postcode.
EDIT: oops, it does not cover GIR 0AA, sorry