tags:

views:

15

answers:

0

We have a field in our application that needs to support US city/zip inputs along the following lines:

  • Boston, MA
  • MA
  • 02114
  • Zone 0

That last input, "Zone 0" is specific to our industry, but can be anything matching "Zone #". There are of course, variations about these themes:

  • Boston MA 02114
  • grand rapids mi
  • ai oh

I'm curious if anyone knows of a good strategy for recognizing and parsing addresses like this. Am I best off just writing a few regexes and seeing which one match?