title: regex.sub() gives different results to re.sub()
body: <p>I work with <a href="http://en.wikipedia.org/wiki/Czechs" rel="nofollow noreferrer">Czech</a> accented text in Python 3.4.</p>
  
  <p>Calling <a href="https://docs.python.org/3.4/library/re.html#re.sub" rel="nofollow noreferrer"><code>re.sub()</code></a> to perform substitution by regex on an accented sentence works well, but using a regex compiled with <a href="https://docs.python.org/3.4/library/re.html#re.compile" rel="nofollow noreferrer"><code>re.compile()</code></a> and then calling <a href="https://docs.python.org/3.4/library/re.html#re.regex.sub" rel="nofollow noreferrer"><code>regex.sub()</code></a> fails.</p>
  
  <p>Here is the case, where I use the same arguments for <a href="https://docs.python.org/3.4/library/re.html#re.sub" rel="nofollow noreferrer"><code>re.sub()</code></a> and <a href="https://docs.python.org/3.4/library/re.html#re.regex.sub" rel="nofollow noreferrer"><code>regex.sub()</code></a></p>
  
  <pre><code>import re
  
  pattern = r'(?&lt;!\*)(Poplatn[ií]\w+ da[nň]\w+)'
  flags = re.I|re.L
  compiled = re.compile(pattern, flags)
  text = 'Poplatníkem daně z pozemků je vlastník pozemku'
  mark = r'**\1**' # wrap 1st matching group in double stars
  
  print(re.sub(pattern, mark, text, flags))
  # outputs: **Poplatníkem daně** z pozemků je vlastník pozemku
  # substitution works
  
  print(compiled.sub(mark, text))
  # outputs: Poplatníkem daně z pozemků je vlastník pozemku
  # substitution fails
  </code></pre>
  
  <p>I believe that the reason is accents, because for a non-accented sentence <a href="https://docs.python.org/3.4/library/re.html#re.sub" rel="nofollow noreferrer"><code>re.sub()</code></a> and <a href="https://docs.python.org/3.4/library/re.html#re.regex.sub" rel="nofollow noreferrer"><code>regex.sub()</code></a> work identically. </p>
  
  <p>But it seems to me like a bug, because passing the same arguments returns different results, which should not happen. This topic is complicated by different platforms and locales, so it may not be reproducible on your system. Here is screenshot of my console.</p>
  
  <p><img src="https://i.stack.imgur.com/xndZo.png" alt="Python console"></p>
  
  <p>Do  you see any fault in my code, or should I report it as a bug?</p>