Case Study: Street Addresses
Explore how to apply Python regular expressions to real-world problems by standardizing street addresses. Understand challenges with simple string replacements and learn to create more accurate patterns using word boundaries and anchors to match and replace street suffixes effectively.
We'll cover the following...
This series of examples was inspired by a real-life problem I had in my day job several years ago, when I needed to scrub and standardize street addresses exported from a legacy system before importing them into a newer system. (See, I don’t just make this stuff up; it’s actually useful.) This example shows how I approached the problem.
① My goal is to standardize a street address so that 'ROAD' is always abbreviated as 'RD.'. At first glance, I thought this was simple enough that I could just use the ...