title: Python regex replace each match with itself plus a new line
body: <p>I have a long regex with many alternations and I want to be able to replace each match from the regex with itself followed by a new line ('\n').</p>
  
  <p>What is the most efficient way to do so with re.sub()?</p>
  
  <p>Here is a simple example:</p>
  
  <pre><code>s = 'I want to be able to replace many words, especially in this sentence, since it will help me solve by problem. That makes sense right?'
  
  pattern = re.compile(r'words[,]|sentence[,]|problem[.]')
  
  for match in matches:
      re.sub(pattern, match + '\n', match)
  </code></pre>
  
  <p>I know this for loop will not work, I am just hoping to clarify what I am trying to solve here. Thanks in advance for any help. I may be missing something very straightforward.</p>