php - Split street, house number and addition from address -



php - Split street, house number and addition from address -

i'm using regular look split dutch street, house number , add-on address. add-on should optional.

preg_match('/(?p<address>[^\d]+) (?p<number>[\d]+)(?p<numberadd>[^\d]+)/', $input, $matches)

this works if $input illustration street 1a. not if input street 1 (without addition).

so how can split address add-on optional? add-on may not contain numbers.

have seek with:

preg_match('/(?p<address>\d+) (?p<number>\d+)(?p<numberadd>\d*)/', $input, $matches)

php regex preg-match

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -