title: Bogus escape error when running regex
body: <p>Yesterday, I got help with the regex matching which worked well as a standalone. But when put into this code, I am getting the "bogus escape error". The code and traceback are below. Could you please point me to what I am doing wrong?</p>
  
  <pre><code>#!/usr/bin/env python
  import re
  
  sf = open("a.txt","r")
  out = open("b.txt","w")
  regex = re.compile(r'Merging\s+\d+[^=]*=\s*\'\w+@\w+\x\w+\'\\"')
  
  
  for line in sf:
      m = regex.findall(line)
      for i in m:
         print &gt;&gt; out,line,
  </code></pre>
  
  <p>The traceback is:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):
      <code>File "match.py", line 6, in &lt;module&gt;
        regex = re.compile(r'Merging\s+\d+[^=]*=\s*\'\w+@\w+\x\w+\'\\"')
      File "/usr/lib/python2.7/re.py", line 190, in compile
        return _compile(pattern, flags)
      File "/usr/lib/python2.7/re.py", line 242, in _compile
        raise error, v # invalid expression
    sre_constants.error: bogus escape: '\\x'</code></p>
  </blockquote>