Writing some regex to help process street addresses. However, I'm unsure if regex is the correct way to go about solving this problem.
I have a street address that looks like this:
7829 Hollywood Ave
I would like to write a regex that says this (pseudo -ode):
match a NUMBER then ONE OR MORE WORDS then a STREET TYPE
In javascript, this regex would look something like this:
/^\d+\s+.*(\sAve|\sStreet|\sSt.|..800 MORE ABBREVIATIONS!...)/ig
As you can see, because there are 800+ postal street "type" abbreviations, this regex would be very large. I would have to actually generate it using computer code, which is ok, but I'm unsure of this is a good way to solve this kind of problem?
I could see this problem getting to the point where I want to write a regex that attempts to match a street NAME with one in a database. Then I really don't see how a standard regex could work in that situation:
match a NUMBER then **A STREET NAME IN A DATABASE** then a STREET TYPE
Any input is appreciated!