fork(1) download
  1. import re
  2. 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?'
  3. pattern = re.compile(r'words[,]|sentence[,]|problem[.]')
  4. s = re.sub(pattern, "\\g<0>\n", s)
  5. print(s)
Success #stdin #stdout 0s 23352KB
stdin
Standard input is empty
stdout
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?