How to parse freeform street/postal address out of text, and into components
Asked 07 September, 2021
Viewed 1.6K times
  • 59
Votes

We do business largely in the United States and are trying to improve user experience by combining all the address fields into a single text area. But there are a few problems:

  • The address the user types may not be correct or in a standard format
  • The address must be separated into parts (street, city, state, etc.) to process credit card payments
  • Users may enter more than just their address (like their name or company with it)
  • Google can do this but the Terms of Service and query limits are prohibitive, especially on a tight budget

Apparently, this is a common question:

Is there a way to isolate an address from the text around it and break it into pieces? Is there a regular expression to parse addresses?

7 Answer