>-----Original Message----- >From: Paul Anderson [mailto:wackyvor...@me.com] >Sent: Monday, January 28, 2013 13:32 >To: Angela Barone >Cc: beginners@perl.org >Subject: Re: Abbreviating ordinals only in the middle of an address > >I'm thinking {2,}\w to match two or more words after north. > >Sent from my iPhone > >On 2013-01-28, at 2:57 PM, Angela Barone <ang...@italian-getaways.com> >wrote: > >> Hello, >> >> I'm trying to abbreviate ordinals(?) that occur only in the middle of >an address and I'm having a problem. The line below works: >> >> $test_data =~ s/(\S) North (\S)/$1 N. $2/i; >> [Wags] From a mail perspective, I would remove the period. Not used in a mailing address. Also depending on what part of the country you are getting addresses from, the direction can come after the street( as in 123 Dell Northwest St or the st might be between street name and direction). Most of them would be NW, but if you are trying to condense the mailing address, something to think about... For official USPS abbreviations, do a search on internet or starting url could be https://www.usps.com/send/official-abbreviations.htm
If you have any questions and/or problems, please let me know. Thanks. Wags ;) David R. Wagner Senior Programmer Analyst FedEx Services 1.719.484.2097 Tel 1.719.484.2419 Fax 1.408.623.5963 Cell http://Fedex.com/us >> however, if the address is something like 901 North St., it abbreviates >that as well. I'm wanting it to work only on an address like >> 53 North Benson St. -> 53 N. Benson St. >> >> Is there a way to know whether or not 'North' is a street name as >opposed to a direction, or am I asking too much? I was thinking of >counting the number of "words" between "North' and 'St.' (and if it's zero >then don't do it), but I wouldn't know how to do that or even if that's the >best way to do it. >> >> Thanks! >> Angela >> -- >> To unsubscribe, e-mail: beginners-unsubscr...@perl.org >> For additional commands, e-mail: beginners-h...@perl.org >> http://learn.perl.org/ >> >> > >-- >To unsubscribe, e-mail: beginners-unsubscr...@perl.org >For additional commands, e-mail: beginners-h...@perl.org >http://learn.perl.org/ > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/