Address extraction from string
<p>I've been looking around for some help, but haven't found my solution yet. The problem is a lot like this one: <a href="https://stackoverflow.com/questions/14087116/extract-address-from-string">Extract address from string</a></p>

<p>But I cannot seem to rewrite the php code to solve my problem.</p>

<p>I'm using Magento and I have only 1 address field combining streetname and housenumber. For my CSV export I'm using a XSLT extension, which can work with PHP also. For retrieving the address and importing, I need streetname and housenumber to be 2 strings.</p>

<p>At this moment I'm using:
preg_replace('/[0-9,.]/','',$address);</p>

<p>for retrieving the street, </p>

<p>and:
preg_replace('/[^0-9,.]/','',$address);</p>

<p>for retrieving the housenumber. And... this just doesn't work in a lot of situations. Because sometimes a number is included in the streetname (like 2nd street) or a character is included in the housenumber (like 36-B).</p>

<p>The only 2 things we always know are "A housenumber always includes a number" and "A housenumber (sometimes including characters) is always at the end of the string"</p>

<p>I've made an image of a few examples:
<a href="https://i.stack.imgur.com/sXtu0.png" rel="nofollow noreferrer">Examples</a></p>