|
> > > Does anyone have a slick way of extracting the postal code? > > > > > > The postal code could be US or Canadian..... I did something similar around five years ago (so don't have the code anymore) extracting UK postcodes from any one of three address lines to put into a dedicated postcode field. The technique was to XLATE the line converting all alphas to 'A' ans all numerics to '1', then scan the result for known postcode patterns. As there are a finite number of patterns (I think I identified seven from our database) is was fairly straightforward to pick them out (eg AA1 1AA, AA11 1AA, A1A 1AA, A1 1AA, etc). This picked all but a handful of codes (where two or more spaces were in the middle), even those that butted up to part of the address without a space. I guess this should work for Canadian (which ISTR are similar to UK ones) but I'm not sure about US codes (five digits only?). Regards, Martin -- martin@dbg400.net / jamaro@firstlinux.net http://www.dbg400.net DBG/400 - DataBase Generation utilities Open Source test environment tools for the AS/400 / iSeries and miscellaneous database & spooled file management commands.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.