Invalid postcode format

From Unknown
Member since Dec -0001

Please could you assist I have encountered this Invalid postcode format. How do i get this sorted i am using 2.X version

tim
Founder
From Sweden
Member since May 2013
tim

Admin -> Countries -> Edit Country -> Postcode Format

Leave field empty for no validating of postcode.

From Unknown
Member since Dec -0001

Customer Details: Invalid postcode format. this is what i am  having I tried all options but its not working

From Unknown
Member since Dec -0001

Thanks Its now working fine

tim
Founder
From Sweden
Member since May 2013
tim

Are the postcode formats that comes with the platform no good? 

Please provide an example if there is something to fix/improve?

From Unknown
Member since Dec -0001

Tim I am trying to work out how best to get this fixed

tim
Founder
From Sweden
Member since May 2013
tim

That's okay. Let me know if any postcode format needs fixing. All you need to provide is a valid postcode and country that was denied by LiteCart. I will find the solution for you.

From Unknown
Member since Dec -0001

L5 8SF was declined by the system and a couple more where denied by the system

tim
Founder
From Sweden
Member since May 2013
tim

Accoarding to http://stackoverflow.com/questions/164979/uk-postcode-regex-comprehensive there is a regex code supplied by the UK Government:

(GIR 0AA)|((([A-Z-[QVX]][0-9][0-9]?)|(([A-Z-[QVX]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVX]][0-9][A-HJKPSTUW])|([A-Z-[QVX]][A-Z-[IJZ]][0-9][ABEHMNPRVWXY])))) [0-9][A-Z-[CIKMOV]]{2})

"L5 8SF" does not validate

This is the code LiteCart uses:

GIR[ ]?0AA|((AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)([0-9][[0-9]A-Z]?[ ]?[0-9][ABD-HJLN-UW-Z]{2}))|BFPO[ ]?[0-9]{1,4}

"L5 8SF" does not validate

It did not even validate with this supplied by appspotr, or my regex parser is broken:

GIR ?0AA|(?:(?:AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|BX|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|SM|SN|SO|SP|SR|SS|ST|SW|SY|TA|TD|TF|TN|TQ|TR|TS|TW|UB|W|WA|WC|WD|WF|WN|WR|WS|WV|YO|ZE)(?:\\d[\\dA-Z]? ?\\d[ABD-HJLN-UW-Z]{2}))|BFPO ?\\d{1,4}

Until a better code shows up you can use **.*** to allow any set of characters.

Merchant
From United Kingdom
Member since May 2017

it seems the UK regex is flawed, LA1 5PE does not validate with or without the space.

tim
Founder
From Sweden
Member since May 2013
tim

How about something universal like

[A-Z]{1,2}[0-9][0-9A-Z]? ?[0-9][A-Z]{2}

Otherwise just go with anything provided

.*
Merchant
From United Kingdom
Member since May 2017

That one works on both of the postcodes posted here L5 8SF and LA1 5PE with and without space. Thank you.

This thread has been closed due to long inactivity. Posting to it is not possible.
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.