I'm using javascript to parse through some data and have run into a bit of a pickle.
I have a field that is 1-3 lines of data.
Usually it is only one line, representing a street address:
1234 Hollywood St.
But sometimes it is something like this:
Beverly Hills Shopping Center 1234 Hollywood St.
Other times it is this:
1234 Hollywood St Ste 12
And other times its stuff like this:
1234 Hollywood St 2nd Floor (between Hollywood St and Tom Cruise Ave)
I'd really like to know which line is the street address. Currently, I'm trying to identify which line is the "Address line 2", meaning the Suite#, Floor number, etc... I don't really need the address, line 2, but by process of elimination, this helps get me the street address.
Is there a nice tool available, like a regex function or something that will tell me if a string is likely a street address?
Or is there another way that I could be handling this?
Thanks!
Edit:
This algorithm does not need to be 100%. I'm preparing the address to be sent to google maps API to be verified. I could try each line of the address to see which one is valid but this would increase the number of calls to google and carry a small, but finite chance of a false positive.
I'd like to be able to scrub the data a little before verifying through google to decrease errors and the necessity for more calls.