I'm attempting to parse the input string entered by the user, to determine which components of the address have been entered. A complication is that users may enter combinations such as:
- 1 Kent Street Sydney (number, name, type, suburb)
- 1 King Georges Road Sydney (number, 2x name, type, suburb)
- 1 New South Head Road Rose Bay (number, 3x name, type, 2x suburb)
- Kent Street Sydney (name, type, suburb)
- Sydney (suburb)
- 2000 (postcode)
- 275/2/1000 (lot/section/plan)
At the moment I'm breaking the input string into tokens using string.split(" ") and iterating through each token to determine which component it represents. Here's a very rough sample.
This is working most of the time (it fails on 1 St Georges Road Sydney), but a colleague suggested I try using a REGEXP to improve the process. I can't see any examples of where this has been done for an address search.
Does anyone have any examples where REGEXP has been used for address validation?
(Note that I'm not actually entering this information into a geocoder at this stage - I just need to break the input string into its component parts, and know what each part represents)