I have a form where the user can enter his/her address. The street number and street name are entered in the same text field. My database stores the street number directly in the address table, while the street name, city, province, and postal code have their own tables (i.e. they are foreign keys)*.
I want to parse the int from the Street Address field so that I can store the number and street name in their appropriate locations. I referred to the solutions on this page: Extract numbers from a string.
The problem is that if my user accidentally types a number in the street name, using any of the solutions on that page would result in an incorrect street number as well. For example:
123 Som3estreet --> 1233
What is the correct approach here?
*Note: I'm not quite sure if this is the best design, so if anyone has any suggestions for improvement, it would be greatly appreciated.