 <p>You could create a regular expression that would match each format you want to accept. When one of them matches, you will know how to parse that particular string. If you think about it, there probably aren't more than 10 common formats people will use to type out an address 99.9% of the time.</p>