3

Is it possible to validate a postal address for its completeness? Meaning, I need to grab autocomplete values using Google Places and after a user select an address I need to validate it if it contains a house number and a postcode.

Holderlinstrasse 12, 11070, Berlin, Germany - is fine

Holderlinstrasse Berlin, Germany - is not

I haven't found any APIs to serve the purpose. I've considered regex, but this also doesn't sound like an easy way.

Any advice? Thank you!

Eugene
  • 59,186
  • 91
  • 226
  • 333

1 Answers1

2

This is generally considered a much more difficult task that you imagine. Legitimate street addresses are extremely hard to identify even by a human. Internationally cities have vastly different ways of expressing addresses and within special environments (like the US military and large business and government organisations) addresses may not have anything like a number, street name or territory.

This closed SO question contains a fair discussion of some possibilities but there is no 100% solution.

Community
  • 1
  • 1
Elemental
  • 7,365
  • 2
  • 28
  • 33