title: How can I find the best fuzzy string match?
body: <p>Python's <a href="https://pypi.python.org/pypi/regex" rel="noreferrer">new regex module</a> supports fuzzy string matching. Sing praises aloud (now). </p>
  
  <p>Per the docs:</p>
  
  <blockquote>
    <p>The <code>ENHANCEMATCH</code> flag makes fuzzy matching attempt to improve the fit
    of the next match that it finds.</p>
    
    <p>The <code>BESTMATCH</code> flag makes fuzzy matching search for the best match
    instead of the next match</p>
  </blockquote>
  
  <p>The <code>ENHANCEMATCH</code> flag is set using <code>(?e)</code> as in </p>
  
  <blockquote>
    <p><code>regex.search("(?e)(dog){e&lt;=1}", "cat and dog")[1]</code> returns "dog"</p>
  </blockquote>
  
  <p>but there's nothing on actually setting the <code>BESTMATCH</code> flag. How's it done?</p>