Start a new topic

RegEx Dictionary Inserting Unwanted Spaces in Address Line

We use RegEx expressions to expand abbreviated directions in address lines.  Abbreviations such as NE, NW, SE, SW become Northeast, Northwest, Southeast, Southwest.


When an address contains one of the expanded directions (Northeast, Northwest, Southeast, Southwest) and it comes after a street number, a space is inserted between the direction and whatever text follows.  


For example:

Incoming data from Excel:

1111 Southeast 6th Street


Data imported on record:

1111 Southeast  6th Street


This does not occur if the address line begins with the direction.  


North, South, East, West directions are not affected.  


The address lines are "trimmed" in Excel before import to remove extra spaces.


When a RegEx expression for the direction abbreviation is removed from the dictionary, the imported address containing the expanded direction (like the example from above) does not contain an extra space.


Attached is an image of one of the offending RegEx expressions; the address record as it appears in RE; the exported dictionary.

csv
spaces.png
(3.29 KB)

Try changing 

(?i)(?<= )(SE \.?|southeast\.?)
(?i)(?<= )(NW \.?|northwest\.?)
(?i)(?<= )(SW \.?|southwest\.?)


to 

(?i)(?<= )(SE \.?|southeast\. ?)
(?i)(?<= )(NW \.?|northwest\. ?)
(?i)(?<= )(SW \.?|southwest\. ?)

with spaces before the last question mark


That did it!  Thank you!

Login or Signup to post a comment