I have to split address and housenumber for a loopup function.
It is important that this works for any kind of addresses, so I am not 100% sure how to do this the best way possible.
Addresses can look like
Mystreet 14a
Mystreet 4
Mystreet 4a
Wilderness and I have no housenumber
I guess the logic should check for a number followed by a letter or two.
Any nice ways to do this?
TO CLARIFY: This is a lookup for Norwegian addresses where I believe the address is one or more words followed by optional number. The number may also contain a optional letter at the end (see examples above).
Try this solution. I used
preg_matchto find a Norwegian address like you described in the question:Sample output: