Start a new topic

RegEx to Format and Abbreviate Street Names

Here is a large set of regular expressions designed to replace a street name with its standardized USPS abbreviation. (See the "Street Suffixes" and "Secondary Units" tabs). It takes an address such as "15800 Countrydrive Avenue blvd., apt. 1506" and formats it to "15800 Countrydrive Ave Blvd Apt 1506". This isn't perfect as it mistakes an intended part of the street name as an abbreviation. Hence "Avenue" becomes "Ave" and some of the meaning is lost. However if the street name includes a possible abbreviation (such as "Countrydrive") then the abbreviation is appropriately NOT applied.
Regular Expressions - Street Suffixes & Secondary Unit Designators.xlsx (UPDATED BY A LATER POST)

The list includes 202 Street Suffixes and 24 Secondary Unit Designators. The "Use Regular Expressions" check box must be painstakingly ticked for each item. The form needs a "Check All" button or link.

image


There are two regular expressions that should also be included, BLANK and PO Box. They are:

1. BLANK --> , AND \. (two match-on entries)
2. PO Box --> (?i)\b((P\.O\.)|(P\. O\.)|(PO BOX)|(POBOX)|(BOX)|(POB)|(P O BOX))\b

Hopefully someone can modify the regular expression format to restrict alterations to only the last word before the Secondary Unit Designator. That would be helpful.

1 person has this question

Hi Mark,


There are a few different versions of this dictionary floating around, but the attached one is what I typically use on my implementations.


Thanks,


John

xlsx

2 people like this

Hi Lei-an, here you go!

xlsx

1 person likes this
Hi. I am trying to fake my way through regular expressions by making changes to some of these created by Omatic, but I am in Canada and many of the abbreviations we use are missing. Many of our rural constituents live on a "Range Road" which they sometimes spell out or incorrectly abbreviate to "Rge", but we want to see it as "Rg Rd"
I seem to have attempted to alter a code that will not change it unless it is at the end of the line or something? Obviously if the word "range" is in another word of the address, I don't want it abbreviated, but it could be preceded by a number or word and followed by "Rd." Could someone take a look at my code and provide advice?

(?i)(?

Solved! Thank you Wayne for a little push in the right direction

This replaces a space comma with a comma:

*  Replacement Value = , (just a plain comma)

*  RegEx = \s\,   

It gets its own dictionary row. I kept trying to fold it into the regex that matches on apartment.

This replaces apartment with , Apt.

*  Replacement Value = , Apt.

 

 RegEx = ?i)(?<= )(apartment\.?)

 

Hi Marcy,

 

Have you tried creating a fresh copy of the dictionary? I've had days like you described, where a dictionary lost its power mysteriously.  Recreating it via copy+paste from Excel always fixed it for me!

 

Both the "short" and "long" versions of the dictionary are still available for download on page 1 of this post.  I hope this helps!

 

Amanda Tetanich, bCRE 

Software Trainer | Omatic Software

 

Thank you for your response Wayne

Yes, the RegExp box is checked for each entry and the TRUE column was copied in.  However, the only one that works is the one for the PO Box, i.e.

Replacement Value:  PO Box

Value to match on:  (?i)\b((P\.O\.)|(P\. O\.)|(PO BOX)|(POBOX)|(BOX)|(POB)|(P O BOX))\b

None of the others work, a couple of examples are:

Replacement Value:  Street

Value to match on:  (?i)(?

Replacement Value: Road

Value to match on:  (?i)(?

I'm stumped.  Any advice you can give would be very helpful.

thanks

Jenny

 

Also, when I tested this PO Box code from this list with "P.o. Box 25", it resulted with "P.o. PO Box 25 instead of replacing the P.o.
I didn't copy the whole dictionary in because they don't all apply to us in Canada and they don't all match the abbreviations we use. Would that have affected the way the dictionary understood it?

(?i)\b((P\.O\.)|(P\. O\.)|(PO BOX)|(POBOX)|(BOX)|(POB)|(P O BOX))\b
Posted By Amanda Tetanich on 19 Mar 2015 03:37 PM

Hi Marcy,

Have you tried creating a fresh copy of the dictionary? I've had days like you described, where a dictionary lost its power mysteriously.  Recreating it via copy+paste from Excel always fixed it for me!

Both the "short" and "long" versions of the dictionary are still available for download on page 1 of this post.  I hope this helps!

Amanda Tetanich, bCRE 

Software Trainer | Omatic Software

Amanda,

I don't see on page 1 of this thread where I can download the 2 versions of the dictionary.  I see his screenshots, but not a download link.

Thanks in advance.

Barbara

Those look ok to me. I would suggest just trying one line, like the Road one, and getting that to work first.

Make sure to try a full address and not just "rd" because it might be looking for only rd that is at the end of an address line.
It's a little hidden in there, I agree! If you look closely, the posts are in chronological order by date. Look for the post from "24 Jan 2013 07:53 PM". This links to download are contained within it!
Does Blackbaud have an AddressAccelerator product for Canada? If so, I would import the data as is and then run AA against it. It is then matching to exact addresses per your postal system and not using simple find/replace.
Hello all,
We're new to IOM and recently created a profile for our Online donations. This dictionary has been tremendously helpful and saved me hours/days of work! Thank you Patrick!

-Diana
Wayne is correct. The regular expressions are looking for a space before "rd" and it being at the end of the line or being followed by "," or " #".

Hello Amanda, 

Sorry for the delayed response and yes, I did try to copy and paste in a dictionary. The same results happen.  It seems that all the other dictionaries are fine.  I saw a email that with RE's last update, some APIs are not working - could this be an issue?

 

Thanks, Marcy

Is there a regular expression for changing expiration dates?  In a CSV file the dates are fine, but if I save it and have to reopen the file, EXCEL changes the dates from Jun-16 to 16-Jun and RE doesn't like that.  I've got an Excel workaround but wondered if Omatic had a regular expression for this? 

Thanks.

Tammy

 

 

Login or Signup to post a comment