I am trying to parse and address to pull out the zip code from and address and it have written this regex \s(\d{5}[^a-zA-Z]*)\s and it works perfect until I hit an address that has a house number that matches that pattern.
Example:
David Rose PO Box 31741 Little Rock, Arkansas 72148 Unites States |
74168 River Bend Road Searcy, Arkansas 72149 United States |
I don't know if there a work around or if that is just something i just have to live with.
Hi @lbolin
Is it safe to say that the "," will always be included?
Option1:
.*,.*(\d{5}).*
If it will always end with United States (one record is misspelling United) so perhaps this could work
Option 2:
(\d{5})\s\w+\s\w+$
@lbolin
Agree with @christine_assaad , we need a flag to differ the zip code with other five digits number.
Or try a hard way, Use Find and Replace with Zip Code list.
http://phaster.com/zip_code.html
Hi @lbolin
If the data always ends with "United States" you could use GetWord to isolate the Zipcode.
Getword ([Full Address], CountWords([Full Address])-3)