title: List of strings, replace all words from other list
body: <p>Python novice here. </p>
  
  <p>I have a list of documents, and another list of search terms. I would now like to iterate over each document, and replace all occurrences of any of the search terms with something like <code>&lt;placeholder&gt;</code>. It should, however, only match full words, so <code>text.replace</code> probably does not work?</p>
  
  <p>So, something like this:</p>
  
  <pre><code>document_list =  ['I like apples', 'I like bananas', 'I like apples and bananas and pineapples', 'I like oranges, but not blood oranges.']
  search_list = ['apples', 'bananas', 'blood oranges']
  
  Out: ['I like &lt;placeholder&gt;', 'I like &lt;placeholder&gt;', 'I like &lt;placeholder&gt; and &lt;placeholder&gt; and pineapples', 'I like oranges, but not &lt;placeholder&gt;.']
  </code></pre>
  
  <p>Right now, I have something like</p>
  
  <pre><code>for document in document_list:
      for term in search_list:
          document = re.sub(r'\b{}\b'.format(term),'&lt;placeholder&gt;',document)
  </code></pre>
  
  <p>This seems to work, but is really (and I mean <em>really</em>) slow.If I were to run this on my full dataset of ~10k documents, with a search_list of probably ~5k terms, it would take several days to finish. 
  Is there any better way to approach this problem and make it faster?</p>
  
  <p>Thanks a lot in advance!</p>
  
  <p>Edit1: Maybe it's worth mentioning that the terms in <code>search_list</code>can also consist of multiple words. Edited the example accordingly. </p>
  
  <p>Edit2: Thanks for pointing to the other thread, had not found that one before. Sorry about that. As mentioned below, I'd still be curious to hear other, non-regex solutions just to learn about them. The actual problem has been soved through the other thread, though. =)  </p>