title: How to use '\' in Python lookbehind assertion regex (?<=\\) to match C++-like quoted strings
body: <p>How can I match <strong>r'\a'</strong> in Python using lookbehind assertion?<br>
  Actually, I need to match C++ strings like <code>"a \" b"</code> and </p>
  
  <pre><code>"str begin \
  end"
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>&gt;&gt;&gt; res = re.compile('(?&lt;=\)a')
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/lib/python2.7/re.py", line 190, in compile
      return _compile(pattern, flags)
    File "/usr/lib/python2.7/re.py", line 244, in _compile
      raise error, v # invalid expression
  
  &gt;&gt;&gt; res = re.compile('(?&lt;=\\)a')
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/lib/python2.7/re.py", line 190, in compile
      return _compile(pattern, flags)
    File "/usr/lib/python2.7/re.py", line 244, in _compile
      raise error, v # invalid expression
  sre_constants.error: unbalanced parenthesis
  
  &gt;&gt;&gt; res = re.compile('(?&lt;=\\\)a')
  &gt;&gt;&gt; ms = res.match(r'\a')
  &gt;&gt;&gt; ms is None
  True
  </code></pre>
  
  <p><strong>Real Example:</strong><br>
  When I'm parcing <code>"my s\"tr"; 5;</code> like <code>ms = res.match(r'"my s\"tr"; 5;')</code>, the expected output is: <code>"my s\"tr"</code></p>
  
  <p><strong>Answer</strong><br>
  Finally <em>stribizhev</em> provided the solution. I thought my initial regex is less computationally expensive and the only issue was that it should be declared using a raw string:</p>
  
  <pre><code>&gt;&gt;&gt; res = re.compile(r'"([^\n"]|(?&lt;=\\)["\n])*"', re.UNICODE)
  &gt;&gt;&gt; ms = res.match(r'"my s\"tr"; 5;')
  &gt;&gt;&gt; print ms.group()
  "my s\"tr"
  </code></pre>