I would like to be able to convert regex postal code formats into DBEdit
field formats. There are 251 countries in the list. It would be neat if the
R:Base database control could receive a format from the max field in the table
by lookup. I can easily enough set the mask programmatically based on the
country - I've been doing it for US, CA and MX for several years. I have a
possible use for all the countries in the ISO list.

Here is a sample set of data from Andorra, Canada,Cocos Islands
and USA.

    CountryC PostCodeFormat       Regex                Mask
-------- -------------------- -------------------- ---------------------
    AD       AD999                (?:AD)*(\d{3})$ >\A\D_999;1;_

    CA       A9A 9A9              (?!.*[DFIOQU])[A-VX >L0L_0L0;1;_
Illegal characters by
Trigger or EEP

    CC       6799 W3              (6799 W3)$ >0000_W3;1;_

    US       99999-9999           \d{5}([\-]\d{4})?$ >0000_9999;1;_
Insert hyphen by EEP?

Andorra has three digits for each parish preceded by the country code AD
Canada uses letter, number, letter, space, number, letter, number, but does not
       use the letters DFIOQU
Cocos Islands has four digits, a space and literal W3
USA has five digits always, allows hyphen and four more digits


Reply via email to