I'm terrible at regex
so forgive the basicness of this question. I currently have the following regex
that will identify a UK postcode at the end of a string:
([a-zA-Z]{1,2}([0-9]{1,2}|[0-9][a-zA-Z])\s*[0-9][a-zA-Z]{2}$)
And this works fine. However I'm now trying to do the opposite in that I want a regex
that will identify everything else in the string, but NOT the postcode at the end of it. I've amended the regex as so:
((.+)[a-zA-Z]{1,2}([0-9]{1,2}|[0-9][a-zA-Z])\s*[0-9][a-zA-Z]{2}$)
This successfully breaks it into capture groups, the string minus the postcode is identified (using a regex tester) as capture group 1. However, I don't know how to get it to select capture group 1 only?