I'm looking to amend a string that we will receive from customers. The scenario is that we will ask the customer for the first part of their post code - in the UK, a post code is either 6 or 7 characters long. If it's 6 characters, the format is 3+3 and if it's 7 characters, it is 4+3. We would have post codes in a data table and then see if it's a match or not.
We need to account for customers that give us the whole post code. What I'd like to do is strip the last 3 characters off of those post codes, leaving us with the first 3 or 4 characters. So if a customer says TA1 1AA, we get left with TA1.
Could someone suggest an expression that would help me do this please?