I agree it's horrible. . . and unfortunately, I can be sure of very little regarding the formatting. I see a number of records that put commas between city and state (which isn't really a big problem), and some which abbreviate state names with things like "MASS", and "WASH" (oh, joy).
Thanks for the good wishes. . . | [reply] |
You're basically going to have to quantify the different possibilities and allow for them individually. I was able to get the zip codes accurately from your sample data:
unless ( ($zip) = ($field5 =~ /(\d{5}-\d{4})/)) {
unless ( ($zip) = ($field5 =~ /(\d{5})/)) {
unless ( ($zip) = ($field4 =~ /(\d{5}-\d{4})/)
+) {
($zip) = ($field4 =~ /(\d{5})/);
+
}
}
}
but that's already pretty nasty... | [reply] [d/l] |
Actually, I see that the third record from the bottom has a 5-digit ZIP code, with no dash and other part... Could be that we need to make the second part optional... Yeah, oh joy...
--------------------------------
An idea is not responsible for the people who believe in it...
| [reply] |