-2

Address Validator

Please give me regular expression formula to validate those fields. Unfortunately in this app I am unable to use java script in .ascx/.aspx page. So can I use javascript to pop up a map to locate the address in code behind file?? or what should I do?

Atsy G
  • 73
  • 2
  • 7
  • 3
    SO is not a "please give me X" site. – Raymond Chen Jun 03 '13 at 03:48
  • 1
    This has been addressed many times here on stackoverflow. That must mean it's a good question. The best answer is probably this one: http://stackoverflow.com/questions/11160192/how-to-parse-freeform-street-postal-address-into-components – Jeffrey Jun 07 '13 at 18:10

1 Answers1

2

A regex for address is not functionally possible. Pretty much anything can be a valid address. They only way to ensure integrity there is via a call to a geo location service. https://developers.google.com/maps/documentation/geocoding/ But you cannot be sure that even that would not disallow potentially valid addresses.

As for what should you do "validate and locate me" it is easiest to do a form submission and corresponding page navigation : http://www.sitepoint.com/net-form-processing-basics/

basarat
  • 261,912
  • 58
  • 460
  • 511