title: Python user input as regular expression, how to do it correctly?
body: <p>I'm using Python 3. In my application, the use can input a regular expression string directly and the application will use it to match some strings. For example the user can type <code>\t+</code>. However I can't make it work as I can't correctly convert it to a correct regular expression. I've tried and below is my code.</p>
  
  <pre><code>&gt;&gt;&gt; import re
  &gt;&gt;&gt; re.compile(re.escape("\t+")).findall("  ")
  []
  </code></pre>
  
  <p>However when I change the regex string to <code>\t</code>, it will work. </p>
  
  <pre><code>&gt;&gt;&gt; re.compile(re.escape("\t")).findall("   ")
  ['\t']
  </code></pre>
  
  <p>Note the parameter to <code>findall</code> IS a tab character. I don't know why it seems not correctly displayed in Stackoverflow. </p>
  
  <p>Anyone can point me the right direction to solve this? Thanks. </p>