Gangabass has asked for the wisdom of the Perl Monks concerning the following question:
Hi guys
I need to parse addresses. But unfortunately the address string is simple text string without any separators. Here are some examples:
I must get from this string Address, City and Postal code. So for given strings it will be:
It's not so hard to get Postal code:
my ($postal) = $dirty_address =~ m/(\w+){2}$/;
My main problem is separating city name and street name (cause city name maybe several words). Can you suggest something to me? Maybe there is module that do such things?
It this moment my only idea is to look to the first occurence of the street prefix (St, Rd, Drv) from Postal code. When i find it -- part from prefix till Postal code is city name. But I don't know all prefixes :-(
P.S. This is Yellowpages search results.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing addresses
by bruceb3 (Pilgrim) on Sep 19, 2007 at 09:57 UTC | |
|
Re: Parsing addresses
by apl (Monsignor) on Sep 19, 2007 at 09:55 UTC | |
|
Re: Parsing addresses
by Burak (Chaplain) on Sep 19, 2007 at 10:49 UTC | |
|
Re: Parsing addresses
by moritz (Cardinal) on Sep 19, 2007 at 09:28 UTC | |
|
Re: Parsing addresses
by tweetiepooh (Hermit) on Sep 19, 2007 at 12:18 UTC | |
|
Re: Parsing addresses
by Gangabass (Vicar) on Sep 20, 2007 at 00:47 UTC |