HACKER Q&A
📣 bryanrasmussen

Sources for Regions Required in Addresses for Countries


There's lots of libraries for parsing or verifying that an address is correct, but are there any libraries that will return regions required in a country address format or even better a list of required fields?

If not that - is there any online data source that one can download and get required regions for addresses per country?

I don't need to know how to format an address, which is what everyone seems to think I should want, I need to know what fields will be required in a particular country to make the user inputs.


  👤 gus_massa Accepted Answer ✓
Why do you need the address?

Do you want to add and remove fields from the webpage according to the country?

I think the general recommendation is to let the user input whatever sting s/he wants, because it's impossible to know the weird formats of each part of the world. (In some tiny towns, "name" + "town" + "province" + "country" is enough. Bonus point for "zip". Street name? There are no streets, homes are just on the side of the main road, on in a secondary road that is only an unnamed dirt strip.)