How to split address and extract the postal number from address?

Hi!
I’m stuggling to extract the postal number as string from these addresses. When last two letters are present they are aso part of the postal number. See these examples.

Van Baerlestraat 27Amsterdam 1071 AN
Amstelvlietstraat 4Amsterdam 1096

I’m thinking to split from second space and extract what comes after, but am struggling to figure out how to do this. Any help to point me in the right direction would be highly appreciated.

Br Johan

@jpwin
depending on much you can rely on the data (e.g. Variations of a Streetnumber could be 21a 15/3 etc. as well) have a look on following regex:

grafik

with resulting groups:
grafik

for working with regex and groups have a look here:
Regex help tutorial MEGAPOST – Making your first Regex post, Reusable Regex Patterns, Regex Troubleshooting, Sample Workflow and more

3 Likes