title: regex match and replace multiple patterns
body: <p>I have a situation where a user submits an address and I have to replace 
  user inputs to my keys. I can join this using an address without suffixes.</p>
  
  <p>COVERED WAGON TRAIL</p>
  
  <p>CHISHOLM TRAIL</p>
  
  <p>LAKE TRAIL</p>
  
  <p>CHESTNUT ST</p>
  
  <p>LINCOLN STREET</p>
  
  <p>to:</p>
  
  <p>COVERED WAGON</p>
  
  <p>CHISHOLM</p>
  
  <p>LAKE</p>
  
  <p>CHESTNUT</p>
  
  <p>LINCOLN</p>
  
  <p>However I can't comprehend how this code can be written to replace only the last word.
  I get:</p>
  
  <p>LINCOLN</p>
  
  <p>CHESTNUT</p>
  
  <p>CHISHOLM</p>
  
  <p>LAKEAIL</p>
  
  <p>CHISHOLMAIL</p>
  
  <p>COVERED WAGONL</p>
  
  <p>I've tried regex verbose, re.sub and $.</p>
  
  <pre><code>import re
  target = '''
  
  LINCOLN STREET
  CHESTNUT ST
  CHISHOLM TR
  LAKE TRAIL
  CHISHOLM TRAIL
  COVERED WAGON TRL
  
  '''
  rdict = {
  ' ST': '',
  ' STREET': '',
  ' TR': '',
  ' TRL': '',
  }
  robj = re.compile('|'.join(rdict.keys()))
  re.sub(' TRL', '',target.rsplit(' ', 1)[0]), target
  result = robj.sub(lambda m: rdict[m.group(0)], target)
  print result
  </code></pre>