title: Python treat variable as literal/raw string
body: <p>I can't believe it's that difficult to treat a <strong>variable</strong> as a <strong>raw string</strong>! I have searched and found questions alike, but no proper answer.</p>
  
  <p>I have a variable with domain name stored in. e.g. 'domain\user', I need to get the username only using <code>re</code>. The problem is Python gives me hex values for special character combinations, for example when I have <code>\b</code> in the string.</p>
  
  <p>I just need to get the literal string from the variable, and nothing else.</p>
  
  <pre><code>author = list[0] // list[0] contains 'domain\blah'
  author = re.sub('.*\\\\(.+)$', r'\1', author)
  </code></pre>
  
  <p>I'd expect <code>blah</code>, getting <code>'domain\x08lah'</code>!</p>
  
  <p>Saving the string as raw string at the start is not an option, because I'm getting the string from other regex operations.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I was mistaken by assuming the variable had a single slash in. In fact, when getting the variable from another operation, the backclash had already been escaped. So I was making it a problem for myself when trying to create a test scenario.</p>