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

 

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

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!

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

Hi Marcy,

If other Regular Expression dictionaries are working fine, then the address one should too. I was just able to use it successfully in a Blackbaud-hosted database last week, and we haven't received any reports of a greater issue among other users, to my knowledge.

A few things to try would be to try saving the downloaded copy of the dictionary in XLSX format (if it's not already), make sure you're creating a new dictionary rather than adding to an old one, and make sure you apply the correct copy in your profile. You may want to try manually typing in one of the translations in a fresh dictionary to narrow down whether it's the copy/paste or the dictionaries themselves causing this issues.

Amanda Tetanich, bCRE
Software Trainer | Omatic Software

Thanks, I'll give it a try.  Stay tuned. 

I'm using the Address Abbreviations Long and Short Directions. We like our addresses to read 123 Anywhere Street, Apt. 7
I need to have a dot (.) after Apt. The regex Value to Match: , Apartment and the value to match is (?i)(? I can't figure out where to insert the dot to have it come out correctly. I've tried changing the value to match to Apt. but the dot just won't come through.
Thanks for any help.
Barbara
I believe there is an entry in the dictionary at the end to remove all punctuation.

Sort the replacement values to find --BLANK--. That will match on \. and \,           That's the entry that removes the period and comma from everything.

I am putting the Long Address regex dictionary to good use and it is working well. My nemesis is a pesky comma. Let me start with an example:

Address provided: 234 w. ln. apartment #3b.
Result: 234 West Lane Apt. #3b
The result is pretty good. Except a comma space is required to precede Apt.

So following any kind of street, road, lane, avenue, etc. etc. can be EOL or comma

Apt./Unit/Suite must be on the same line, preceded with comma space

Like this: 234 West Lane, Apt. #3b

How, oh HOW, do I get the comma space in there?

Please, someone help or I am doomed to be in the company of Zaphod Beeblebrox for the rest of my natural life. Please don't let that happen.
Can you replace ' Apt' with ', Apt'?

My attempt to use ", Apt." as a replacement value leaves a space before the comma

you need to make sure that you are also including the space in the value to replace so that it gets overwritten.

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\.?)

 

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
Login or Signup to post a comment