title: Remove all occurrences of words in a string from a python list
body: <p>I'm  trying to match and remove all words in a list from a string using a compiled regex but I'm struggling to avoid occurrences within words.</p>
  
  <p>Current:</p>
  
  <pre><code> REMOVE_LIST = ["a", "an", "as", "at", ...]
  
   remove = '|'.join(REMOVE_LIST)
   regex = re.compile(r'('+remove+')', flags=re.IGNORECASE)
   out = regex.sub("", text)
  </code></pre>
  
  <p>In: <em>"The quick brown fox jumped over an ant"</em></p>
  
  <p>Out: <em>"quick brown fox jumped over t"</em></p>
  
  <p>Expected: <em>"quick brown fox jumped over"</em></p>
  
  <p>I've tried changing the string to compile to the following but to no avail:</p>
  
  <pre><code> regex = re.compile(r'\b('+remove+')\b', flags=re.IGNORECASE)
  </code></pre>
  
  <p>Any suggestions or am I missing something garishly obvious?</p>