Contradictory values in fuzzy_counts and fuzzy_changes

Create issue
Issue #364 resolved
Kale Kundert created an issue

I’ve come across a few simple regular expressions for which fuzzy_counts and fuzzy_changes give contradictory information (e.g. one suggests that there are substitutions, while the other suggests that there are insertions/deletions). I’ve only seen this behavior with regex.BESTMATCH, but that may or may not be relevant. Here are some examples:

>>> import sys
>>> print(sys.version)
3.8.0 (default, Dec  6 2019, 18:40:21) 
[Clang 9.0.0 (tags/RELEASE_900/final)]
>>> import regex
>>> regex.__version__
'2.5.74'
>>> m = regex.match('(abc){e}', 'ac', flags=regex.BESTMATCH)
>>> m.fuzzy_counts, m.fuzzy_changes
((0, 0, 1), ([1], [], []))
>>> m = regex.match('(abc){e}', 'axbc', flags=regex.BESTMATCH)
>>> m.fuzzy_counts, m.fuzzy_changes
((0, 1, 0), ([1], [], []))

In both examples, I think fuzzy_counts is correct. I’d expect fuzzy_changes to be ([], [], [1]) in the first example and ([], [1], []) in the second.

Other possibly relevant information:

OS: Arch
Kernel: Linux 5.5.2-arch1-1
Architecture: x86-64
Byte order: little endian

Comments (2)

  1. Log in to comment