Python's new regex module supports fuzzy string matching. Sing praises aloud (now).
Per the docs:
The
ENHANCEMATCHflag makes fuzzy matching attempt to improve the fit of the next match that it finds.The
BESTMATCHflag makes fuzzy matching search for the best match instead of the next match
The ENHANCEMATCH flag is set using (?e) as in
regex.search("(?e)(dog){e<=1}", "cat and dog")[1]returns "dog"
but there's nothing on actually setting the BESTMATCH flag. How's it done?