Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complex regular Expression - format inconsistent

Status
Not open for further replies.

SPrelewicz

Programmer
Jul 16, 2001
124
US
I have a general "Address" field in a text data set. I need to extract from the general address field specific elements, such as "Address 1", Addy2", City", etc..

The problem is the formatting of that field is tough for this. Occassionay, theres a comma after the building number, occassionally there isnt any commas, spacing is also inconsistent. So, here are some examples [UK addresses]

"Philton, Kemnay, Inverurie, Aberdeenshire AB51 5PB"
"12, Morlich Avenue, Ellon, Aberdeenshire AB41 9GJ"
"5, Vaynes Park Brechin Angus DD9 6LA"

The fields I need are (address1, Address2*, City, Region*, Post Code) where *=optional.

Ive tried working backwards, like "Find two blocks of chars separated by a whitespace in $1, etc...but my regex abailites are average. Can anyone offer any advixe?

Thanks you,

Scott
 
This is a very difficult thing to do. I should know, I spent nearly six years doing exactly this kind of thing.
Obviously working backwards is a good idea and maybe it's easier to do it with a batch of regexs.
The postcode is made up of two parts (outbound and inbound).
The second half is much more consistant than the first although London postcodes can be a real pain (like SE1 for example).
You might want to use a lookup system for city and another for county.


Trojan.
 
Thats actually a prettu good idea. Avoid the regex entirely and just map something persistent onto the others. Ill think Ill try this unless someone else can think of something.

Thanks.

Scott
 
Can you post a good chunk of various data?


Kind Regards
Duncan
 
Sure, here are about 100 lines. Note - Ive managed to get a hold of the post code in a separate field. So, theres one step.

"10, Maxwell Gardens, Hurlford, Kilmarnock, Ayrshire," ka1 5by"
"Unit 2, Umberley Rd, Kilmarnock, Ayrshire," ka1 5lb"
"Limekilns Rd, Ayr,," ka8 8dg"
"36, Lloyd Walk, Stewarton, Kilmarnock, Ayrshire," ka3 3df"
"Limekilns Rd, Ayr,," ka8 8dg"
"52, Dunlop Rd, Barrmill, Beith, Ayrshire," ka15 1hn"
"Oldhall West Industrial Estate, Shewalton Rd, Shewalton, Irvine,," ka11 5ar"
"Unit 15, Old Hall West Industrial Estate, Shewalton, Irvine, Ayrshire," ka11 5ar"
"Chemical Works, Weir Rd, Ayr, Ayrshire," ka8 8bd"
"Moycroft Industrial Estate, Elgin, Morayshire," iv30 1xz"
"Checkbar, Nigg, Aberdeen, Aberdeenshire," ab12 4lp"
"Moycroft Ind Est, Elgin, Morayshire," iv30 1xz"
"34, Mount Pleasant Rd, Luton, Bedfordshire," lu3 2rr"
"36, Burr St, Dunstable, Bedfordshire," lu6 3ag"
"Portland Court Managed Work Spaces, Portland Court, Luton, Bedfordshire," lu1 1rs"
"Eastern Way, Leighton Buzzard, Bedfordshire," lu7 9lf"
"British Rail Goods Yard, Chiltern Green Road, Luton, Bedfordshire," lu2 9pw"
"Rushden Road, Bedford, Bedford, Bedfordshire," mk44 1hj"
"63, Carterweys, Dunstable, Bedfordshire," lu5 4rb"
"17, Dexter Close, Luton, Bedfordshire," lu3 4dx"
"The Orchard, Bedford Rd, Houghton Regis, Dunstable, Bedfordshire," lu5 5lj"
"22, Alpine Way, Sundonpark Estate, Luton, Bedfordshire," lu3 4"
"Collec Transit Depot, Billington Rd, Leighton Buzzard, Bedfordshire," lu7 9hh"
"171, Cotton End Rd, Bedford, Bedfordshire," mk45 3dp"
"7, Ulverston Rd, Dunstable, Bedfordshire," lu6 3qe"
"Manor Rd, Kempston Hardwick, Bedford, Bedfordshire," mk43 9nt"
"288, Old Bedford Rd, Luton, Bedfordshire," lu2 7ej"
"1, Covent Garden Close, Luton, Bedfordshire," lu4 8qb"
"Covent Garden Close, Luton, Bedfordshire," lu4 8qb"
"27, Gilderdale, Luton, Bedfordshire," lu4 9na"
"28, Talbot Rd, Luton, Bedfordshire," lu2 7rw"
"Burr St, Dunstable, Bedfordshire," lu6 3ag"
"144, Blundell Rd, Luton, Bedfordshire," lu3 1sp"
"Burr St, Dunstable, Bedfordshire," lu6 3ag"
"171, Cotton End Rd, Wilstead, Bedford, Bedfordshire," mk45 3dp"
"Manor Rd, Kempston Hardwick, Bedford, Bedfordshire," mk43 9nt"
"Manor Rd, Kempston Hardwick, Bedford, Bedfordshire," mk43 9nt"
"12, Brackendale Grove, Luton, Bedfordshire," lu3 2lt"
"Cow Close, Langford Rd, Biggleswade, Bedfordshire," sg18 9jt"
"Covent Garden Close, Luton, Bedfordshire," lu4 8qb"
"Hill Farm, Flitwick Rd, Maulden, Bedford, Bedfordshire," mk45 2bj"
"123, Biscot Rd, Luton, Bedfordshire," lu3 1an"
"380-382, Old Park Rd, Belfast, County Antrim," bt14 6qf"
"Blackmountain Quarry, Upper Springfield Rd, Belfast, County Antrim," bt17 0lz"
"5, Blackstaff Way, Kennedy Way Ind Est, Belfast, County Antrim," bt11 9dt"
"Upper Springfield Rd, Hannahstown, Belfast, County Antrim," bt17 0lu"
"15, Piney Lane, Belfast, County Antrim," bt9 5qs"
"McCaughey Rd, Belfast, County Antrim," bt3 9ag"
"1106, Crumlin Rd, Belfast, County Antrim," bt14 8sa"
"380-382, Old Park Rd, Belfast, County Antrim," bt14 6qf"
"Blackmountain Quarry, Upper Springfield Rd, Belfast, County Antrim," bt17 0lz"
"5, Blackstaff Way, Kennedy Way Ind Est, Belfast, County Antrim," bt11 9dt"
"Upper Springfield Rd, Hannahstown, Belfast, County Antrim," bt17 0lu"
"15, Piney Lane, Belfast, County Antrim," bt9 5qs"
"McCaughey Rd, Belfast, County Antrim," bt3 9ag"
"1106, Crumlin Rd, Belfast, County Antrim," bt14 8sa"
"Venture House, Arlington Square, DOWNSHIRE WAY, Bracknell,," rg12 1wa"
"Simpsons Way, Slough, Berkshire," sl1 3gd"
"Rose Kiln Trading Estate, Rose Kiln Lane, Reading, Berkshire, Berkshire," rg2 0nd"
"Rose Cottage, Foundry Lane, Horton, Slough, Berkshire," sl3 9pd"
"Abbey Business Park, Grenville Place, Bracknell, Berkshire," rg12 1bp"
"1, Victoria Cottage, Maidenhead, Berkshire," sl6 2nz"
"Albany House, Market Street, Maidenhead, Berkshire," sl6 8be"
"7, Newtonside Orchard,Burfield Road, Old Windsor,," sl4 2re"
"Bray Business Centre, Weir Bank, Monkey Island Lane, Bray, Maidenhead, Berkshire," sl6 2ed"
"Mount Pleasant Farm, Goring Heath, Reading, Berkshire," rg8 7tb"
"183, Vicarage Way, Colnbrook, Slough, Berkshire," sl3 0rd"
"19, Mason Street, Reading, Berkshire," rg1 7pd"
"Gainsborough, High Street, Slough, Berkshire," sl1 1dy"
"Burghfield Bridge, Burghfield, Reading, Berkshire," rg30 3xn"
"180, Rodway Rd, Tilehurst, Reading, Berkshire," rg30 6ee"
"27, Eldon Terrace, Reading, Berkshire," rg1 4dx"
"22, Birch Grove, Windsor, Berkshire," sl4 5rt"
"Eastern Rd, Bracknell, Berkshire," rg12 2up"
"73, Colmansmoor Rd, Woodley, Reading, Berkshire," rg5 4dg"
"18, Oakstubbs Lane, Dorney Reach, Maidenhead, Berkshire," sl6 0dw"
"25, Sandford Drive, Woodley, Reading, Berkshire," rg5 4rr"
"Old Stocks Farm, Paices Hill, Reading, Berkshire," rg7 4pg"
"Firtree Farm, Ockwells Rd, Maidenhead, Berkshire," sl6 3aa"
"Birch Grove, Windsor, Berkshire," sl4 5rt"
"Birch Grove, Windsor, Berkshire," sl4 5rt"
"The Hangar, Hangar Rd, Sulhamstead, Reading, Berkshire," rg7 4at"
"79, Liddell Way, Ascot, Berkshire," sl5 9uu"
"20, Caves Farm Close, Sandhurst, Berkshire," gu47 8ea"
"7 Newtonside Orchard, Burfield Rd, Old Windsor, Windsor, Berkshire," sl4 2re"
"Eastern Rd, Bracknell, Berkshire," rg12 2up"
"Slough Trading Estate, Ipswich Rd, Slough, Berkshire," sl1 4ep"
"Belmont Works, Stoke Gardens, Slough, Berkshire," sl1 3qa"
"The Hangar, Hangar Rd, Sulhamstead, Reading, Berkshire," rg7 4at"
"1 Victoria Cottage, Fifield Rd, Fifield, Maidenhead, Berkshire," sl6 2nz"
"63, Beaumont Rd, Slough, Berkshire," sl2 1ng"
"Firtree Cottage, Ockwells Rd, Maidenhead, Berkshire," sl6 3aa"
"4, Coningham Rd, Reading, Berkshire," rg2 8qp"
"The Hangar, Station Rd, Theale, Reading, Berkshire," rg7 4at"
"22, Birch Grove, Windsor, Berkshire," sl4 5rt"
"80a, Reading Rd, Finchampstead, Wokingham, Berkshire," rg40 4ra"
"Fenton House,Unit 19, Colthrop Business Park, Colthrop Lane, Thatcham, Berkshire," rg19 4nt"
"Slough Trading Estate, Ipswich Rd, Slough, Berkshire," sl1 4ep"
"Trunkwell Farm, Grazeley Rd, Beech Hill, Reading, Berkshire," rg7 2at"
"Oakfield Farm,Wells Lane, Ascot, Berkshire," sl5 7dy"
"Green Lane, Maidenhead, Berkshire," sl6 1xz"
"Station Rd, Theale, Reading, Berkshire," rg7 4hn"
"Eastern Rd, Bracknell, Berkshire," rg12 2up
 
Sorry, I have a quoting error in that chunk, heres the proper data:

"Chemical Works, Weir Rd, Ayr, Ayrshire","ka8 8bd"
"Moycroft Industrial Estate, Elgin, Morayshire","iv30 1xz"
"Checkbar, Nigg, Aberdeen, Aberdeenshire","ab12 4lp"
"Moycroft Ind Est, Elgin, Morayshire","iv30 1xz"
"34, Mount Pleasant Rd, Luton, Bedfordshire","lu3 2rr"
"36, Burr St, Dunstable, Bedfordshire","lu6 3ag"
"Portland Court Managed Work Spaces, Portland Court, Luton, Bedfordshire","lu1 1rs"
"Eastern Way, Leighton Buzzard, Bedfordshire","lu7 9lf"
"British Rail Goods Yard, Chiltern Green Road, Luton, Bedfordshire","lu2 9pw"
"Rushden Road, Bedford, Bedford, Bedfordshire","mk44 1hj"
"63, Carterweys, Dunstable, Bedfordshire","lu5 4rb"
"17, Dexter Close, Luton, Bedfordshire","lu3 4dx"
"The Orchard, Bedford Rd, Houghton Regis, Dunstable, Bedfordshire","lu5 5lj"
"22, Alpine Way, Sundonpark Estate, Luton, Bedfordshire","lu3 4"
"Collec Transit Depot, Billington Rd, Leighton Buzzard, Bedfordshire","lu7 9hh"
"171, Cotton End Rd, Bedford, Bedfordshire","mk45 3dp"
"7, Ulverston Rd, Dunstable, Bedfordshire","lu6 3qe"
"Manor Rd, Kempston Hardwick, Bedford, Bedfordshire","mk43 9nt"
"288, Old Bedford Rd, Luton, Bedfordshire","lu2 7ej"
"1, Covent Garden Close, Luton, Bedfordshire","lu4 8qb"
"Covent Garden Close, Luton, Bedfordshire","lu4 8qb"
"27, Gilderdale, Luton, Bedfordshire","lu4 9na"
"28, Talbot Rd, Luton, Bedfordshire","lu2 7rw"
"Burr St, Dunstable, Bedfordshire","lu6 3ag"
"144, Blundell Rd, Luton, Bedfordshire","lu3 1sp"
"Burr St, Dunstable, Bedfordshire","lu6 3ag"
"171, Cotton End Rd, Wilstead, Bedford, Bedfordshire","mk45 3dp"
"Manor Rd, Kempston Hardwick, Bedford, Bedfordshire","mk43 9nt"
"Manor Rd, Kempston Hardwick, Bedford, Bedfordshire","mk43 9nt"
"12, Brackendale Grove, Luton, Bedfordshire","lu3 2lt"
"Cow Close, Langford Rd, Biggleswade, Bedfordshire","sg18 9jt"
"Covent Garden Close, Luton, Bedfordshire","lu4 8qb"
"Hill Farm, Flitwick Rd, Maulden, Bedford, Bedfordshire","mk45 2bj"
"123, Biscot Rd, Luton, Bedfordshire","lu3 1an"
"380-382, Old Park Rd, Belfast, County Antrim","bt14 6qf"
"Blackmountain Quarry, Upper Springfield Rd, Belfast, County Antrim","bt17 0lz"
"5, Blackstaff Way, Kennedy Way Ind Est, Belfast, County Antrim","bt11 9dt"
"Upper Springfield Rd, Hannahstown, Belfast, County Antrim","bt17 0lu"
"15, Piney Lane, Belfast, County Antrim","bt9 5qs"
"McCaughey Rd, Belfast, County Antrim","bt3 9ag"
"1106, Crumlin Rd, Belfast, County Antrim","bt14 8sa"
"380-382, Old Park Rd, Belfast, County Antrim","bt14 6qf"
"Blackmountain Quarry, Upper Springfield Rd, Belfast, County Antrim","bt17 0lz"
"5, Blackstaff Way, Kennedy Way Ind Est, Belfast, County Antrim","bt11 9dt"
"Upper Springfield Rd, Hannahstown, Belfast, County Antrim","bt17 0lu"
"15, Piney Lane, Belfast, County Antrim","bt9 5qs"
"McCaughey Rd, Belfast, County Antrim","bt3 9ag"
"1106, Crumlin Rd, Belfast, County Antrim","bt14 8sa"
"Venture House, Arlington Square, DOWNSHIRE WAY, Bracknell,","rg12 1wa"
"Simpsons Way, Slough, Berkshire","sl1 3gd"
"Rose Kiln Trading Estate, Rose Kiln Lane, Reading, Berkshire, Berkshire","rg2 0nd"
"Rose Cottage, Foundry Lane, Horton, Slough, Berkshire","sl3 9pd"
"Abbey Business Park, Grenville Place, Bracknell, Berkshire","rg12 1bp"
"1, Victoria Cottage, Maidenhead, Berkshire","sl6 2nz"
"Albany House, Market Street, Maidenhead, Berkshire","sl6 8be"
"7, Newtonside Orchard,Burfield Road, Old Windsor,","sl4 2re"
"Bray Business Centre, Weir Bank, Monkey Island Lane, Bray, Maidenhead, Berkshire","sl6 2ed"
"Mount Pleasant Farm, Goring Heath, Reading, Berkshire","rg8 7tb"
"183, Vicarage Way, Colnbrook, Slough, Berkshire","sl3 0rd"
"19, Mason Street, Reading, Berkshire","rg1 7pd"
"Gainsborough, High Street, Slough, Berkshire","sl1 1dy"
"Burghfield Bridge, Burghfield, Reading, Berkshire","rg30 3xn"
"180, Rodway Rd, Tilehurst, Reading, Berkshire","rg30 6ee"
"27, Eldon Terrace, Reading, Berkshire","rg1 4dx"
"22, Birch Grove, Windsor, Berkshire","sl4 5rt"
"Eastern Rd, Bracknell, Berkshire","rg12 2up"
"73, Colmansmoor Rd, Woodley, Reading, Berkshire","rg5 4dg"
"18, Oakstubbs Lane, Dorney Reach, Maidenhead, Berkshire","sl6 0dw"
"25, Sandford Drive, Woodley, Reading, Berkshire","rg5 4rr"
"Old Stocks Farm, Paices Hill, Reading, Berkshire","rg7 4pg"
"Firtree Farm, Ockwells Rd, Maidenhead, Berkshire","sl6 3aa"
"Birch Grove, Windsor, Berkshire","sl4 5rt"
"Birch Grove, Windsor, Berkshire","sl4 5rt"
"The Hangar, Hangar Rd, Sulhamstead, Reading, Berkshire","rg7 4at"
"79, Liddell Way, Ascot, Berkshire","sl5 9uu"
"20, Caves Farm Close, Sandhurst, Berkshire","gu47 8ea"
"7 Newtonside Orchard, Burfield Rd, Old Windsor, Windsor, Berkshire","sl4 2re"
"Eastern Rd, Bracknell, Berkshire","rg12 2up"
"Slough Trading Estate, Ipswich Rd, Slough, Berkshire","sl1 4ep"
"Belmont Works, Stoke Gardens, Slough, Berkshire","sl1 3qa"
"The Hangar, Hangar Rd, Sulhamstead, Reading, Berkshire","rg7 4at"
"1 Victoria Cottage, Fifield Rd, Fifield, Maidenhead, Berkshire","sl6 2nz"
"63, Beaumont Rd, Slough, Berkshire","sl2 1ng"
"Firtree Cottage, Ockwells Rd, Maidenhead, Berkshire","sl6 3aa"
"4, Coningham Rd, Reading, Berkshire","rg2 8qp"
"The Hangar, Station Rd, Theale, Reading, Berkshire","rg7 4at"
"22, Birch Grove, Windsor, Berkshire","sl4 5rt"
"80a, Reading Rd, Finchampstead, Wokingham, Berkshire","rg40 4ra"
"Fenton House,Unit 19, Colthrop Business Park, Colthrop Lane, Thatcham, Berkshire","rg19 4nt"
"Slough Trading Estate, Ipswich Rd, Slough, Berkshire","sl1 4ep"
"Trunkwell Farm, Grazeley Rd, Beech Hill, Reading, Berkshire","rg7 2at"
"Oakfield Farm,Wells Lane, Ascot, Berkshire","sl5 7dy"
"Green Lane, Maidenhead, Berkshire","sl6 1xz"
"Station Rd, Theale, Reading, Berkshire","rg7 4hn"
"Eastern Rd, Bracknell, Berkshire","rg12 2up"
"Unit 3, 40, Wigmore Lane, Reading, Berkshire","rg30 1np"
"rear of 12, Horton Gardens Datchet Rd, Horton, Slough, Berkshire","sl3 9px"
"Trelawney Ind Court, Slough, Berkshire","sl3 7uj"
"Pinchington Lane, Newbury, Berkshire","rg14 7hb"
"Pinchington Lane, Newbury, Berkshire","rg14 7hb"
"Unit 19, Green Lane, Burghfield Bridge, Burghfield, Reading, Berkshire","rg30 3xn"
"Pitchkettle Farm, Goodboys Lane, Grazeley, Reading, Berkshire","rg7 1nd"
"15, Onslow Rd, Birmingham, West Midlands","b11 3pa"
"240, Bordesley Green, Birmingham, West Midlands","b9 4su"
"Unit 3, Rotton Park St, Edgbaston, Birmingham, West Midlands","b16 0ab"
"Unit 2, Cherrywood Industrial Estate, Raleigh Rd, Birmingham, West Midlands","b9 4tl"
"5, St. Clements Rd, Birmingham, West Midlands","b7 5af"
"238-244, Brodesley Green, Birmingham, West Midlands","b9 4su"
"5, Kiln Lane, Birmingham, West Midlands","b25 8hf"
"Garretts Green Industrial Estate, Bannerley Road, Garretts Green, Birmingham, West Midlands","b33 0sl"
"251, Bordesley Green Road, Birmingham, West Midlands","b8 1by"
"27, Colmore Row, Birmingham, West Midlands","b3 2ew"
"108, Edgware Rd, Birmingham, West Midlands","b23 6jh"
"Cato St, Nechells, Birmingham, West Midlands","b7 4ts"
"44, Dowar Rd, Rednal, Birmingham, West Midlands","b45 8ra"
"28, Spring Hill Passage, Ladywood, Birmingham, West Midlands","b18 7ah"
"146, Charles Henry St, Birmingham, West Midlands","b12 0sd"
"Unit 6 Spring Hill Industrial Park, Eyre Street, Birmingham, West Midlands","b18 7aa"
"88, Botha Rd, Birmingham, West Midlands","b9 5lp"
"Railway Sidings, Aston Church Rd, Nechells, Birmingham, West Midlands","b8 1qf"
"1635, Pershore Rd, Stirchley, Birmingham, West Midlands","b30 2jf
 
I'd be tempted to split the address into an array and then pop elements off the end, checking for sanity as I go. Checking the postcode against
Code:
/[A-Z]{1,2}[\d]{1,2}[A-Z]? \d[A-Z]{1,2}[A-Z]?/
should give a good measure of confidence.

There aren't that many cities so I'd be temptd to get a list of them (I can probably find one if you wish) and set them as keys of a hash, so that I could use exists() to make sure that the field I was considering was one. I could use this to differentiate between addresses with regions and those without. If you have enough data it might be possible to extract a definitive list of regions and use the same technique.

Once I'd filled the important fields, working from the end, I'd join() the remaining leading fields with ', ' to populate address1.

I've done a bit of this (I work for a distribution company handling several thousands of shipments a day) and it is hard and depressing. There are so many variations (my postcode was once WC1X 8ER) and so little consistancy.

I use the PAF library to validate (and, where I can, generate) addresses and I've found that it pays to validate at initial entry time if at all possible. It's almost impossible to automatically and reliably correct any problems later on, even though it's theorectically possible to generate everything else from the postcode and first line.

Good luck.

Yours,


fish

["]As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.["]
--Maur
 
Thanks fish. Im going to try out your suggestion and see what I can do with it.

Thanks much,
Scott
 
I'm having a stupidly busy week so, if you post more, I may not be able to reply as quickly as I would usually like but I'll try to check in at least once a day.

Yours,

fish

["]As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.["]
--Maur
 
Fish,
Your regex would not cope with "SE1" as I suggested earlier.
Having said that, the list above shows the postcode already separated so that should not be an issue.
A simple regex could lose the comma after the house number and then splitting on comma would give an array that could then be processed for town / city / county.
As you say, there are not that many cities or counties or even towns so this is not an impossible task.
London is always interesting. Is it a town or a city (or even county!)?


Trojan.
 
Hi SPrelewicz

You mentioned:-

The fields I need are (address1, Address2*, City, Region*, Post Code) where *=optional.

how would you break this address up?
"Unit 19, Green Lane, Burghfield Bridge, Burghfield, Reading, Berkshire","rg30 3xn"


Kind Regards
Duncan
 
Remove the first Comma, so that 'Unit Number' is now correctly not delimited and is part of address1. Id then (Perhaps incorrectly) That up to the next comma could be stored in Address 2. After that, Id have to start using the advice above and checking a list of towns/counties, against this, as Ive no idea in Burghfield, Reading, Berkshire what is what there.

Ha, not much help, but...
 
how's this for a start?

Code:
[b]#!/usr/bin/perl[/b]

while (<DATA>) {

  chomp;
  
  s/"//g;
  s/(\d+),/$1/g;
  s/, /,/g;
  
  @components = split(/,/);
  
  $postcode = uc(pop @components); 
       $region = pop @components;
         $city = pop @components;
     $address2 = pop @components;
  
  $address1 = '';
  
  while (@components) {
    $address1 .= ' ' . shift @components;
  }
         
  print "$address1\t$address2\t$city\t$region\t$postcode\n";

}

[blue]__DATA__
"Chemical Works, Weir Rd, Ayr, Ayrshire","ka8 8bd"
"Moycroft Industrial Estate, Elgin, Morayshire","iv30 1xz"
"Checkbar, Nigg, Aberdeen, Aberdeenshire","ab12 4lp"
"Moycroft Ind Est, Elgin, Morayshire","iv30 1xz"
"34, Mount Pleasant Rd, Luton, Bedfordshire","lu3 2rr"
"36, Burr St, Dunstable, Bedfordshire","lu6 3ag"
"Portland Court Managed Work Spaces, Portland Court, Luton, Bedfordshire","lu1 1rs"
"Eastern Way, Leighton Buzzard, Bedfordshire","lu7 9lf"
"British Rail Goods Yard, Chiltern Green Road, Luton, Bedfordshire","lu2 9pw"
"Rushden Road, Bedford, Bedford, Bedfordshire","mk44 1hj"
"63, Carterweys, Dunstable, Bedfordshire","lu5 4rb"
"17, Dexter Close, Luton, Bedfordshire","lu3 4dx"
"The Orchard, Bedford Rd, Houghton Regis, Dunstable, Bedfordshire","lu5 5lj"
"22, Alpine Way, Sundonpark Estate, Luton, Bedfordshire","lu3 4"
"Collec Transit Depot, Billington Rd, Leighton Buzzard, Bedfordshire","lu7 9hh"
"171, Cotton End Rd, Bedford, Bedfordshire","mk45 3dp"
"7, Ulverston Rd, Dunstable, Bedfordshire","lu6 3qe"
"Manor Rd, Kempston Hardwick, Bedford, Bedfordshire","mk43 9nt"
"288, Old Bedford Rd, Luton, Bedfordshire","lu2 7ej"
"1, Covent Garden Close, Luton, Bedfordshire","lu4 8qb"
"Covent Garden Close, Luton, Bedfordshire","lu4 8qb"
"27, Gilderdale, Luton, Bedfordshire","lu4 9na"
"28, Talbot Rd, Luton, Bedfordshire","lu2 7rw"
"Burr St, Dunstable, Bedfordshire","lu6 3ag"
"144, Blundell Rd, Luton, Bedfordshire","lu3 1sp"
"Burr St, Dunstable, Bedfordshire","lu6 3ag"
"171, Cotton End Rd, Wilstead, Bedford, Bedfordshire","mk45 3dp"
"Manor Rd, Kempston Hardwick, Bedford, Bedfordshire","mk43 9nt"
"Manor Rd, Kempston Hardwick, Bedford, Bedfordshire","mk43 9nt"
"12, Brackendale Grove, Luton, Bedfordshire","lu3 2lt"
"Cow Close, Langford Rd, Biggleswade, Bedfordshire","sg18 9jt"
"Covent Garden Close, Luton, Bedfordshire","lu4 8qb"
"Hill Farm, Flitwick Rd, Maulden, Bedford, Bedfordshire","mk45 2bj"
"123, Biscot Rd, Luton, Bedfordshire","lu3 1an"
"380-382, Old Park Rd, Belfast, County Antrim","bt14 6qf"
"Blackmountain Quarry, Upper Springfield Rd, Belfast, County Antrim","bt17 0lz"
"5, Blackstaff Way, Kennedy Way Ind Est, Belfast, County Antrim","bt11 9dt"
"Upper Springfield Rd, Hannahstown, Belfast, County Antrim","bt17 0lu"
"15, Piney Lane, Belfast, County Antrim","bt9 5qs"
"McCaughey Rd, Belfast, County Antrim","bt3 9ag"
"1106, Crumlin Rd, Belfast, County Antrim","bt14 8sa"
"380-382, Old Park Rd, Belfast, County Antrim","bt14 6qf"
"Blackmountain Quarry, Upper Springfield Rd, Belfast, County Antrim","bt17 0lz"
"5, Blackstaff Way, Kennedy Way Ind Est, Belfast, County Antrim","bt11 9dt"
"Upper Springfield Rd, Hannahstown, Belfast, County Antrim","bt17 0lu"
"15, Piney Lane, Belfast, County Antrim","bt9 5qs"
"McCaughey Rd, Belfast, County Antrim","bt3 9ag"
"1106, Crumlin Rd, Belfast, County Antrim","bt14 8sa"
"Venture House, Arlington Square, DOWNSHIRE WAY, Bracknell,","rg12 1wa"
"Simpsons Way, Slough, Berkshire","sl1 3gd"
"Rose Kiln Trading Estate, Rose Kiln Lane, Reading, Berkshire, Berkshire","rg2 0nd"
"Rose Cottage, Foundry Lane, Horton, Slough, Berkshire","sl3 9pd"
"Abbey Business Park, Grenville Place, Bracknell, Berkshire","rg12 1bp"
"1, Victoria Cottage, Maidenhead, Berkshire","sl6 2nz"
"Albany House, Market Street, Maidenhead, Berkshire","sl6 8be"
"7, Newtonside Orchard,Burfield Road, Old Windsor,","sl4 2re"
"Bray Business Centre, Weir Bank, Monkey Island Lane, Bray, Maidenhead, Berkshire","sl6 2ed"
"Mount Pleasant Farm, Goring Heath, Reading, Berkshire","rg8 7tb"
"183, Vicarage Way, Colnbrook, Slough, Berkshire","sl3 0rd"
"19, Mason Street, Reading, Berkshire","rg1 7pd"
"Gainsborough, High Street, Slough, Berkshire","sl1 1dy"
"Burghfield Bridge, Burghfield, Reading, Berkshire","rg30 3xn"
"180, Rodway Rd, Tilehurst, Reading, Berkshire","rg30 6ee"
"27, Eldon Terrace, Reading, Berkshire","rg1 4dx"
"22, Birch Grove, Windsor, Berkshire","sl4 5rt"
"Eastern Rd, Bracknell, Berkshire","rg12 2up"
"73, Colmansmoor Rd, Woodley, Reading, Berkshire","rg5 4dg"
"18, Oakstubbs Lane, Dorney Reach, Maidenhead, Berkshire","sl6 0dw"
"25, Sandford Drive, Woodley, Reading, Berkshire","rg5 4rr"
"Old Stocks Farm, Paices Hill, Reading, Berkshire","rg7 4pg"
"Firtree Farm, Ockwells Rd, Maidenhead, Berkshire","sl6 3aa"
"Birch Grove, Windsor, Berkshire","sl4 5rt"
"Birch Grove, Windsor, Berkshire","sl4 5rt"
"The Hangar, Hangar Rd, Sulhamstead, Reading, Berkshire","rg7 4at"
"79, Liddell Way, Ascot, Berkshire","sl5 9uu"
"20, Caves Farm Close, Sandhurst, Berkshire","gu47 8ea"
"7 Newtonside Orchard, Burfield Rd, Old Windsor, Windsor, Berkshire","sl4 2re"
"Eastern Rd, Bracknell, Berkshire","rg12 2up"
"Slough Trading Estate, Ipswich Rd, Slough, Berkshire","sl1 4ep"
"Belmont Works, Stoke Gardens, Slough, Berkshire","sl1 3qa"
"The Hangar, Hangar Rd, Sulhamstead, Reading, Berkshire","rg7 4at"
"1 Victoria Cottage, Fifield Rd, Fifield, Maidenhead, Berkshire","sl6 2nz"
"63, Beaumont Rd, Slough, Berkshire","sl2 1ng"
"Firtree Cottage, Ockwells Rd, Maidenhead, Berkshire","sl6 3aa"
"4, Coningham Rd, Reading, Berkshire","rg2 8qp"
"The Hangar, Station Rd, Theale, Reading, Berkshire","rg7 4at"
"22, Birch Grove, Windsor, Berkshire","sl4 5rt"
"80a, Reading Rd, Finchampstead, Wokingham, Berkshire","rg40 4ra"
"Fenton House,Unit 19, Colthrop Business Park, Colthrop Lane, Thatcham, Berkshire","rg19 4nt"
"Slough Trading Estate, Ipswich Rd, Slough, Berkshire","sl1 4ep"
"Trunkwell Farm, Grazeley Rd, Beech Hill, Reading, Berkshire","rg7 2at"
"Oakfield Farm,Wells Lane, Ascot, Berkshire","sl5 7dy"
"Green Lane, Maidenhead, Berkshire","sl6 1xz"
"Station Rd, Theale, Reading, Berkshire","rg7 4hn"
"Eastern Rd, Bracknell, Berkshire","rg12 2up"
"Unit 3, 40, Wigmore Lane, Reading, Berkshire","rg30 1np"
"rear of 12, Horton Gardens Datchet Rd, Horton, Slough, Berkshire","sl3 9px"
"Trelawney Ind Court, Slough, Berkshire","sl3 7uj"
"Pinchington Lane, Newbury, Berkshire","rg14 7hb"
"Pinchington Lane, Newbury, Berkshire","rg14 7hb"
"Unit 19, Green Lane, Burghfield Bridge, Burghfield, Reading, Berkshire","rg30 3xn"
"Pitchkettle Farm, Goodboys Lane, Grazeley, Reading, Berkshire","rg7 1nd"
"15, Onslow Rd, Birmingham, West Midlands","b11 3pa"
"240, Bordesley Green, Birmingham, West Midlands","b9 4su"
"Unit 3, Rotton Park St, Edgbaston, Birmingham, West Midlands","b16 0ab"
"Unit 2, Cherrywood Industrial Estate, Raleigh Rd, Birmingham, West Midlands","b9 4tl"
"5, St. Clements Rd, Birmingham, West Midlands","b7 5af"
"238-244, Brodesley Green, Birmingham, West Midlands","b9 4su"
"5, Kiln Lane, Birmingham, West Midlands","b25 8hf"
"Garretts Green Industrial Estate, Bannerley Road, Garretts Green, Birmingham, West Midlands","b33 0sl"
"251, Bordesley Green Road, Birmingham, West Midlands","b8 1by"
"27, Colmore Row, Birmingham, West Midlands","b3 2ew"
"108, Edgware Rd, Birmingham, West Midlands","b23 6jh"
"Cato St, Nechells, Birmingham, West Midlands","b7 4ts"
"44, Dowar Rd, Rednal, Birmingham, West Midlands","b45 8ra"
"28, Spring Hill Passage, Ladywood, Birmingham, West Midlands","b18 7ah"
"146, Charles Henry St, Birmingham, West Midlands","b12 0sd"
"Unit 6 Spring Hill Industrial Park, Eyre Street, Birmingham, West Midlands","b18 7aa"
"88, Botha Rd, Birmingham, West Midlands","b9 5lp"
"Railway Sidings, Aston Church Rd, Nechells, Birmingham, West Midlands","b8 1qf"
"1635, Pershore Rd, Stirchley, Birmingham, West Midlands","b30 2jf"[/blue]


Kind Regards
Duncan
 
there's alot of data in Reading... is that where you are? i only ask as i was born there


Kind Regards
Duncan
 
Fish,
Can you mention who you were working for when you did all this address processing stuff?


Trojan.
 
I'm still here (c 14 years). Did you want the company name?

f

[&quot;]As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.[&quot;]
--Maur
 
I did, or at least a clue like area or something.
It's just that I did PAF and address stuff for nearly 6 years in the city and just wondered if it was for the same company.


Trojan.
 
Haha it would be really funny.
I have a friend, which boss once gave him some program to do. He posted it in a forum. Sbd answered him, but my friend have told him that this is stupid way. So after some hours conversations, they have started cursing each other.
The next day the boss entered the room and said "Hah I aslo post in this forum, there is a very stupid guy I am arguing here for problem similar to yours. Btw what is your nickname..."

Corwin
 
LOL
How cool is that!
:)
I don't mind though (as I guess you'll have noticed).
If I believe in something I'll argue it regardless who I'm arguing with. If the other person presents a strong case though, I am always ready to listen and learn.


Trojan.
 
Yes I know.
This is just a funny story from a friend, I remembered while reading this thread. :)

Corwin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top