title: How do I get this regular expression to ignore accented characters?
body: <p>I have a text file that my script is reading and getting the most frequent words from. However, at one point in the process of doing that, during the clean-up of the source text, it cannot handle accented characters (in this case, they are áéíóöőúüű).</p>
  
  <p>This is what I have at the moment.</p>
  
  <pre><code>str = re.sub(r'\W+', ' ', str)
  </code></pre>
  
  <p>This simply deletes the accented characters. I have tried adding <code>flags=re.U</code>, but it just messed up the result in a different way. I suspect there is a simple way to solve my problem and I have looked for it, but haven't been successful and so I turn to you. Thanks in advance.</p>