Re: UK Validate Diff (Again)
| From: | David Grant | Date: | Fri, 27 Feb 2004 10:24:40 +0000 |
| Subject: | Re: UK Validate Diff (Again) | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-25906@lists.php.net to get a copy of this message | ||
Stefan,
Stefan Neufeind wrote:
On 25 Feb 2004 at 22:02, David Grant wrote:The current function correctly handles numbers and letters in the correct way for the majority of cases, but there is a danger of accepting an invalid postcode. The possible combinations are (where A = A-Z and N = 0-9): AAN NAA AANA NAA AANN NAA AN NAA ANA NAA ANN NAA The regex currently allows AANNA NAA and ANNA NAA, which do not occur in the UK postal code system. In addition, the "strong" method, also dictates which values of A are in the current system in their respective places. The standard on which this regex is based dictates the postal system, rather than vice-versa. http://www.govtalk.gov.uk/gdsc/html/noframes/PostCode-2-1-Release.htmI'm not sure if this list is supposed to be exhaustive, but I've modified the code to change the regex if the strong parameter is set to true. This regex takes into account postcodes that do not occur in the Royal Mail list, by excluding unused letters in certain locations.Could you please give some further background on this? Is there also information online somewhere? Where the "special cases" you're talking about not yet handled by the current function or are you intending to make it even "stronger"?
Have you got some official postcodes for the testcases (true and false one's) please?Valid: CF23 7JN BS8 4UD GU19 5AT CF11 6TA SW1A 1AA NW9 0EQ Invalid: AB12C 1AA B12D 3XY Q1 5AT BI10 4UD Regards, David