I am importing user data from a foreign database on demand. While i keep house numbers separate from the street names, the other database does not.
I use
preg_match_all('!\d+!')
To rule out the numbers. This works fine for an addressline like this:
streetname 60
But it does not work for an addressline like this:
streetname 60/2/3
In that case i end up extracting 60, and /2/3 stay in the name of the street.
Unfortunately i am not a regex expert. Quite to the contrary. My problem is that i need to be able to not only detect numerics, but also slashes and hyphens.
Can someone help me out here?
Try:
preg_match_all('![0-9/-]+!', 'streetname 60/2/3', $matches);