Re: RegEx for UK Postal Codes

2003-04-02 Thread Jon Reades
Sorry everyone, I should remember never to post regexes to a list without testing them first. Spent a little time in Q/A and discovered that this original one passed through all kinds of rubbish. Jon Reades wrote: m/ [A-PR-UWYZ] (?: [0-9](?:[0-9]|A-HJKS-UW])? | [A-HK-Y][0-

RE: RegEx for UK Postal Codes

2003-04-02 Thread Mike Reed
I recall that Hong Kong is BFPO 1. :) Send mail thousands of miles overseas for the price of a 1st class stamp... -- Mike (Learning Perl with the 3rd edition, but very slowly.)

Re: RegEx for UK Postal Codes

2003-04-02 Thread Robin Szemeti
On Tuesday 01 April 2003 14:35, David M. Wilson wrote: > The only other thing I could offer you is a recommendation to buy the > PAF if your budget allows it. all I can say on that point is 'streetmap' and 'LWP' are two rather fine words/accronyms aren't they. hey ho :) -- Robin Szemeti Red

Re: RegEx for UK Postal Codes

2003-04-01 Thread Jon Reades
This hardly qualifies as a clear RegEx, but I *think* that this fits all of the rules as summarised below: m/ [A-PR-UWYZ] (?: [0-9](?:[0-9]|A-HJKS-UW])? | [A-HK-Y][0-9](?:[0-9]|[ABEHMNPRVWXY])? ) \s \d[ABD-HJLNP-UW-Z]{2} /x All this is while leaving out, for the time

Re: RegEx for UK Postal Codes

2003-04-01 Thread Kåre Olai Lindbach
On Tue, 01 Apr 2003 17:16:20 +0200, you ("Philip Newton" <[EMAIL PROTECTED]>) wrote: >On 1 Apr 2003 at 13:47, Ulf wrote: > >> At Tuesday, 1 April 2003, you wrote: >> >> >>m/[A-Z]{1,2}\d{1,2}[A-Z]{0,1}\W\d{1,1}[A-Z]{2,2}/ >> >> In Sweden, where I come from, postal codes are just 5 digits, so >>

Re: RegEx for UK Postal Codes

2003-04-01 Thread Dave Cross
From: Jon Reades <[EMAIL PROTECTED]> Date: 4/1/03 10:47:55 AM > I'm doing a little UK address validation, and after > looking around on CPAN didn't come up with much except > Reg::Common::zip, and that didn't cover UK addresses > (Damian, your name is on this Module, are you listening? > :) )

Re: RegEx for UK Postal Codes

2003-04-01 Thread Dave Cross
From: Jon Reades <[EMAIL PROTECTED]> Date: 4/1/03 10:47:55 AM > I'm doing a little UK address validation, and after > looking around on CPAN didn't come up with much except > Reg::Common::zip, and that didn't cover UK addresses > (Damian, your name is on this Module, are you listening? > :) )

Re: RegEx for UK Postal Codes

2003-04-01 Thread Bob Walker
On Tue, 1 Apr 2003, Philip Newton wrote: > On 1 Apr 2003 at 16:53, Nicholas Clark wrote: > > > It may not be clear that the "she" in question is also the head of state > > of a lot of places (Australia, Canada, Grenada, the UK to name but a few). > > Ah! Brenda. > > (Is she still called that? My f

Re: RegEx for UK Postal Codes

2003-04-01 Thread Lusercop
On Tue, Apr 01, 2003 at 04:47:25PM +0100, Paul Mison wrote: > On 01/04/2003 at 15:43 +0100, Jon Reades wrote: > > >2. Outcodes of the form [A-Z]{1,2}\d[A-Z] may in fact only apply to > >London-area addresses for the time being. > > I think this is right, but can't confirm it. > > >In fact, in a

Re: RegEx for UK Postal Codes

2003-04-01 Thread Philip Newton
On 1 Apr 2003 at 16:53, Nicholas Clark wrote: > It may not be clear that the "she" in question is also the head of state > of a lot of places (Australia, Canada, Grenada, the UK to name but a few). Ah! Brenda. (Is she still called that? My father sometimes uses the name, but he came to Germany o

Re: RegEx for UK Postal Codes

2003-04-01 Thread Nicholas Clark
On Tue, Apr 01, 2003 at 04:37:51PM +0100, S Watkins wrote: > I know I'm probably going to regret this but... > > Nicholas Clark wrote: > > (The head of state in the Bailiwick of Guernsey is the Duke of Normandy. > > I think she's also the head of state in Jersey > > > Nicholas Clark > > So.. the

Re: RegEx for UK Postal Codes

2003-04-01 Thread Paul Mison
On 01/04/2003 at 15:43 +0100, Jon Reades wrote: 2. Outcodes of the form [A-Z]{1,2}\d[A-Z] may in fact only apply to London-area addresses for the time being. I think this is right, but can't confirm it. In fact, in a list of postcodes that I found there appeared to be only three addresses in this

Re: RegEx for UK Postal Codes

2003-04-01 Thread S Watkins
I know I'm probably going to regret this but... Nicholas Clark wrote: (The head of state in the Bailiwick of Guernsey is the Duke of Normandy. I think she's also the head of state in Jersey Nicholas Clark So.. the "Duke" of Normandy is a "she"? Or this some heraldic anomoly to do with location/p

Re: RegEx for UK Postal Codes

2003-04-01 Thread Philip Newton
On 1 Apr 2003 at 13:47, Ulf wrote: > At Tuesday, 1 April 2003, you wrote: > > >>m/[A-Z]{1,2}\d{1,2}[A-Z]{0,1}\W\d{1,1}[A-Z]{2,2}/ > > In Sweden, where I come from, postal codes are just 5 digits, so > you would say: > > m/[0-9]{3}\s*[0-9]{2}/ Germany is even easier: /[0-9]{5}/ Since the co

Re: RegEx for UK Postal Codes

2003-04-01 Thread Graham Barr
On Tue, Apr 01, 2003 at 03:43:16PM +0100, Jon Reades wrote: > And the following exceptions are also valid to some degree: > > 1. GIR 0AA -- a bank that sounds like they were issued this code either > so long ago that they hadn't decided on a format, or completely by accident GiroBank was origina

Re: RegEx for UK Postal Codes

2003-04-01 Thread Nicholas Clark
On Tue, Apr 01, 2003 at 03:43:16PM +0100, Jon Reades wrote: > And the following exceptions are also valid to some degree: > > 1. GIR 0AA -- a bank that sounds like they were issued this code either > so long ago that they hadn't decided on a format, or completely by accident The National Giro B

Re: RegEx for UK Postal Codes

2003-04-01 Thread Dirk Koopman
On Tue, 2003-04-01 at 15:43, Jon Reades wrote: > 1. [A-Z]0 is unused (I can find no incidences) > 2. Outcodes of the form [A-Z]{1,2}\d[A-Z] may in fact only apply to > London-area addresses for the time being. In fact, in a list of > postcodes that I found there appeared to be only three addresse

Re: RegEx for UK Postal Codes

2003-04-01 Thread Jon Reades
This is good for simple validation, but one of the things that has become clear from the thread is that there are a number of additional rules that govern whether a postcode is validly formatted. The additional rules (from a gov web site) *appear* to be: 1. The letters Q, V and X are not used i

Re: RegEx for UK Postal Codes

2003-04-01 Thread Marty Pauley
On Tue Apr 1 11:47:55 2003, Jon Reades wrote: > I'm doing a little UK address validation, and after looking around on We use CGI::Untaint::uk_postcode. The "CGI" is misleading; you can use the Untaint modules without needing any CGI stuff. -- Marty

RE: RegEx for UK Postal Codes

2003-04-01 Thread Richard Clyne
Subject: RegEx for UK Postal Codes I'm doing a little UK address validation, and after looking around on CPAN didn't come up with much except Reg::Common::zip, and that didn't cover UK addresses (Damian, your name is on this Module, are you listening? :) ). Almost everywhere els

Re: RegEx for UK Postal Codes

2003-04-01 Thread Ulf
At Tuesday, 1 April 2003, you wrote: >>m/[A-Z]{1,2}\d{1,2}[A-Z]{0,1}\W\d{1,1}[A-Z]{2,2}/ In Sweden, where I come from, postal codes are just 5 digits, so you would say: m/[0-9]{3}\s*[0-9]{2}/ // Ulf Harnhammar === EASY and FRE

Re: RegEx for UK Postal Codes

2003-04-01 Thread Simon Wistow
On Tue, Apr 01, 2003 at 01:12:24PM +0100, Simon Wilcox said: > On Tue, 2003-04-01 at 13:07, Jon Reades wrote: > > > > Yikes, there's also BFPO... > > Is that actually a postcode ? > > AFAIK it's the acronym for British Forces Posted Overseas and is just > part of an address that doesn't have a p

Re: RegEx for UK Postal Codes

2003-04-01 Thread David M. Wilson
On Tue, Apr 01, 2003 at 11:47:55AM +0100, Jon Reades wrote: > According to the government document found here (this is the google > cache for those of you without Word): > > http://216.239.53.100/search?q=cache:33rseCRZr6wC:www.lscdata.gov.uk/data/Annex%2520C.doc+what+is+UK+postal+code+format&hl

Re: RegEx for UK Postal Codes

2003-04-01 Thread Simon Wilcox
On Tue, 2003-04-01 at 13:25, Jon Reades wrote: > > Yes, you're right -- it's military and not technically a postcode > (neither is SAN TA1). I'd guess, however, that many people would throw > it into the postcode field of a form since it rather 'looks like one' > (although one wouldn't expect t

Re: RegEx for UK Postal Codes

2003-04-01 Thread David M. Wilson
On Tue, Apr 01, 2003 at 11:47:55AM +0100, Jon Reades wrote: > Would anyone care to offer any improvements or suggestions? One other thought I had forgotten: there are a few 'odd' postal codes, although you shouldn't have to worry about them. See the PDF I posted 30 seconds ago. David.

Re: RegEx for UK Postal Codes

2003-04-01 Thread Jon Reades
I just came across this: http://www.govtalk.gov.uk/gdsc/html/noframes/PostCode-2-1-Release.htm Maybe all those tax dollars spent on modernisation *are* producing something worthwhile (online documentation, even a UML diagram!). :) jon -- jon reades fulcrum analytics t: 0870.366.9338 m: 0797.69

Re: RegEx for UK Postal Codes

2003-04-01 Thread Alex Hudson
On Tue, Apr 01, 2003 at 01:12:24PM +0100, Simon Wilcox wrote: > AFAIK it's the acronym for British Forces Posted Overseas and is just > part of an address that doesn't have a postcode, as not all addresses > need them. For instance Named Freepost addresses don't have them. British Forces Post Offi

Re: RegEx for UK Postal Codes

2003-04-01 Thread Jon Reades
Yes, you're right -- it's military and not technically a postcode (neither is SAN TA1). I'd guess, however, that many people would throw it into the postcode field of a form since it rather 'looks like one' (although one wouldn't expect to encounter too many of these while doing validation). j

Re: RegEx for UK Postal Codes

2003-04-01 Thread Peter Sergeant
> Yikes, there's also BFPO... I seem to remember, and perhaps incorrectly, that BFPO is not part of a postcode, and takes a form similar to: Peter Sergeant BFPO 5 UK But it's been a long time since I lived somewhere reachable by one... +Pete -- A cucumber should be well-sliced, dressed with p

Re: RegEx for UK Postal Codes

2003-04-01 Thread Simon Wilcox
On Tue, 2003-04-01 at 13:07, Jon Reades wrote: > > Yikes, there's also BFPO... Is that actually a postcode ? AFAIK it's the acronym for British Forces Posted Overseas and is just part of an address that doesn't have a postcode, as not all addresses need them. For instance Named Freepost addresse

Re: RegEx for UK Postal Codes

2003-04-01 Thread Jon Reades
Yikes, there's also BFPO... Why can't I be validating Canadian addresses? Email sent to Abigail. jon Philip Newton wrote: On 1 Apr 2003 at 13:23, Philip Newton wrote: I seem to recall that there were a couple of additional weird postal codes (from when Abigail asked on a newsgroup or mailing

Re: RegEx for UK Postal Codes

2003-04-01 Thread Lusercop
On Tue, Apr 01, 2003 at 12:02:52PM +0100, Andy Kelk wrote: > Similarly, E4 7PT is valid but E4 0PT is not. ^ I believe this statement to be false -- Lusercop.net - LARTing Lusers everywhere since 2002

Re: RegEx for UK Postal Codes

2003-04-01 Thread Philip Newton
On 1 Apr 2003 at 13:23, Philip Newton wrote: > I seem to recall that there were a couple of additional weird postal > codes (from when Abigail asked on a newsgroup or mailing list > somewhere). Found it. Have a look at http://archive.develooper.com/[EMAIL PROTECTED]/, the thread "Zip/Postal co

Re: RegEx for UK Postal Codes

2003-04-01 Thread Jon Reades
Paul Johnson wrote: Jon Reades said: I'm doing a little UK address validation, and after looking around on CPAN didn't come up with much except Reg::Common::zip, and that didn't cover UK addresses (Damian, your name is on this Module, are you listening? :) ). Abigail <[EMAIL PROTECTED]> was wo

Re: RegEx for UK Postal Codes

2003-04-01 Thread Paul Mison
On 01/04/2003 at 11:47 +0100, Jon Reades wrote: So far my regex looks like this (using the {} notation for consistency and readability): m/[A-Z]{1,2}\d{1,2}[A-Z]{0,1}\W\d{1,1}[A-Z]{2,2}/ there's the interesting additional fact that C I K M O V cannot be used in the incode (the letters that come af

Re: RegEx for UK Postal Codes

2003-04-01 Thread Alex Hudson
On Tue, Apr 01, 2003 at 12:02:52PM +0100, Andy Kelk wrote: > ISTR (although I can't find where now) that 0 is not valid for the > numeric parts. I am not 100% sure on that... I don't think that is the case, although possibly it was once. There appear to be codes near Manchester that start at 0, an

RE: RegEx for UK Postal Codes

2003-04-01 Thread Adam C Auden
On Tue, 1 Apr 2003, Andy Kelk wrote: > ISTR (although I can't find where now) that 0 is not valid for the > numeric parts. I am not 100% sure on that... > If so, you can't have E0 7PT but you can have E20 7PT. > Similarly, E4 7PT is valid but E4 0PT is not. I can confirm that 0 is valid for the s

RE: RegEx for UK Postal Codes

2003-04-01 Thread Andy Kelk
> On Tue, 1 Apr 2003, Andy Kelk wrote: > > > ISTR (although I can't find where now) that 0 is not valid for the > > numeric parts. I am not 100% sure on that... If so, you > can't have E0 > > 7PT but you can have E20 7PT. Similarly, E4 7PT is valid > but E4 0PT is > > not. > > I can confirm

Re: RegEx for UK Postal Codes

2003-04-01 Thread Paul Johnson
Jon Reades said: > I'm doing a little UK address validation, and after looking around on > CPAN didn't come up with much except Reg::Common::zip, and that didn't > cover UK addresses (Damian, your name is on this Module, are you > listening? :) ). Abigail <[EMAIL PROTECTED]> was working on this

Re: RegEx for UK Postal Codes

2003-04-01 Thread Jon Reades
Merde. I just found: "Edenfield",Lancashire,BL0 "Ramsbottom",Greater Manchester,BL0 "Shuttleworth",Greater Manchester,BL0 "Stubbins",Lancashire,BL0 "Asheldham",Essex,CM0 "Bradwell Waterside",Essex,CM0 "Bradwell-on-Sea",Essex,CM0 "Burnham-on-Crouch",Essex,CM0 "Deal Hall",Essex,CM0 "Dengie",Essex,C

Re: RegEx for UK Postal Codes

2003-04-01 Thread Jon Reades
Andy Kelk wrote: ISTR (although I can't find where now) that 0 is not valid for the numeric parts. I am not 100% sure on that... If so, you can't have E0 7PT but you can have E20 7PT. Similarly, E4 7PT is valid but E4 0PT is not. So you could do: m/[A-Z]{1,2}[1-9]{1,1}\d{0,1}[A-Z]{0,1}\W[1-9]{1

Re: RegEx for UK Postal Codes

2003-04-01 Thread Philip Newton
On 1 Apr 2003 at 11:47, Jon Reades wrote: > I'm doing a little UK address validation, and after looking around on > CPAN didn't come up with much except Reg::Common::zip, and that didn't > cover UK addresses (Damian, your name is on this Module, are you > listening? :) ). Abigail is apparently

Re: RegEx for UK Postal Codes

2003-04-01 Thread Alex Hudson
On Tue, Apr 01, 2003 at 11:47:55AM +0100, Jon Reades wrote: > So far my regex looks like this (using the {} notation for consistency > and readability): > > m/[A-Z]{1,2}\d{1,2}[A-Z]{0,1}\W\d{1,1}[A-Z]{2,2}/ Works for my list of postcodes here (except, I can only match the gross code - the first

RE: RegEx for UK Postal Codes

2003-04-01 Thread Shevek
On Tue, 1 Apr 2003, Andy Kelk wrote: > > So far my regex looks like this (using the {} notation for > > consistency > > and readability): > > > > m/[A-Z]{1,2}\d{1,2}[A-Z]{0,1}\W\d{1,1}[A-Z]{2,2}/ > > > > According to the government document found here (this is the google > > cache for those o

RE: RegEx for UK Postal Codes

2003-04-01 Thread Andy Kelk
> So far my regex looks like this (using the {} notation for > consistency > and readability): > > m/[A-Z]{1,2}\d{1,2}[A-Z]{0,1}\W\d{1,1}[A-Z]{2,2}/ > > According to the government document found here (this is the google > cache for those of you without Word): ISTR (although I can't find whe

Re: RegEx for UK Postal Codes

2003-04-01 Thread Peter Sergeant
> m/[A-Z]{1,2}\d{1,2}[A-Z]{0,1}\W\d{1,1}[A-Z]{2,2}/ I would personally rewrite it like this: m/ [A-Z]{1,2} \d{1,2} [A-Z]? \W \d [A-Z]{2} /x +Pete -- Almost all absurdity of conduct arises from the imitation of those whom we cannot resemble. --

RegEx for UK Postal Codes

2003-04-01 Thread Jon Reades
I'm doing a little UK address validation, and after looking around on CPAN didn't come up with much except Reg::Common::zip, and that didn't cover UK addresses (Damian, your name is on this Module, are you listening? :) ). Almost everywhere else tried to sell me a service. So far my regex looks