title: How to use regex to append characters before carriage return and newline
body: <pre><code>var = 'line1samplehere\r\nline2samplehere\r\nline3samplehere\r\n'
  add = '12345'
  </code></pre>
  
  <p>I want to be able to search where '\r\n' is located and append the add string before that. I've researched and tried re.sub replacement<code>re.sub(r'("\r\n"), add,var)</code> but obviously having errors. Any advice?</p>