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; > > 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/