fork download
  1. import re
  2. text = '\\\\r \\\\nLove the filtered water \rand crushed ice in the door.'
  3. r_text = r'\\r \\nLove the filtered water ' + '\rand crushed ice in the door.'
  4. print(f"--'{text}'--")
  5. print(f"Is `text` == `r_text` ? ", text==r_text)
  6.  
  7. new_text = re.sub(r"\\[rtnfv]|[\t\n\r\f\v]"," ",text)
  8. print(new_text)
Success #stdin #stdout 0.03s 9532KB
stdin
Standard input is empty
stdout
--'\\r \\nLove the filtered water 
and crushed ice in the door.'--
Is `text` == `r_text` ?  True
\  \ Love the filtered water  and crushed ice in the door.