[Gllug] OT: Police Web Site

general_email at technicalbloke.com general_email at technicalbloke.com
Thu Feb 3 04:55:10 UTC 2011


On 03/02/11 04:04, general_email at technicalbloke.com wrote:
> On 02/02/11 11:24, John Winters wrote:
>> On Tue, 1 Feb 2011 19:37:06 +0000, John G Walker
>> <johngeoffreywalker at yahoo.co.uk> wrote:
>> [snip]
>>> I got the same message. Then I tried entering my postcode using upper
>>> case letters. I had better luck with this.
>> This sort of thing always makes my gnash my teeth.  Normalising input
>> (particularly postcodes) is so easy there's no excuse not to do it.  (But
>> you need to put in an exception for GIR 0AA, assuming it still exists.)
>>
>> I booked a ferry trip earlier this week and the site refused my mobile
>> phone number saying I had to enter it without spaces in it.  Grrrr.
<snip>
> Also, normalising a UK postcode is easy, validating it can be a little
> more complicated...
>
> ^(GIR
> 0AA)|(((A[BL]|B[ABDHLNRSTX]?|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]?|F[KY]|G[LUY]?|H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]?|M[EKL]?|N[EGNPRW]?|O[LX]|P[AEHLOR]|R[GHM]|S[AEGKLMNOPRSTY]?|T[ADFNQRSW]|UB|W[ADFNRSV]|YO|ZE)[1-9]?[0-9]|((E|N|NW|SE|SW|W)1|EC[1-4]|WC[12])[A-HJKMNPR-Y]|(SW|W)([2-9]|[1-9][0-9])|EC[1-9][0-9])
> [0-9][ABD-HJLNP-UW-Z]{2})$
>
> *bleugh*
>
> Roger.
> --
> Gllug mailing list  -  Gllug at gllug.org.uk
> http://lists.gllug.org.uk/mailman/listinfo/gllug
>


Oops, actually that should have been: ^(GIR
0AA)|(((A[BL]|B[ABDHLNRSTX]?|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]?|F[KY]|G[LUY]?|H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]?|M[EKL]?|N[EGNPRW]?|O[LX]|P[AEHLOR]|R[GHM]|S[AEGKLMNOPRSTY]?|T[ADFNQRSW]|UB|W[ADFNRSV]|YO|ZE)[1-9]?[0-9]|((E|N|NW|SE|SW|W)1|EC[1-4]|WC[12])[A-HJKMNPR-Y]|(SW|W)([2-9]|[1-9][0-9])|EC[1-9][0-9])
?[0-9][ABD-HJLNP-UW-Z]{2})$

Assuming you want to allow for omission of the space in the entered
postcode - an even more common validation annoyance!

Roger.


--
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list