Specifying character set when fuzzy-matching allows characters not in the set

Create issue
Issue #371 resolved
Sharon Hüffner created an issue

Thanks for these amazing features!

I’m having an issue with specifying character sets. I’m trying to match 6-20 digit numbers, with up to 5 delimiters in between, where the delimiters are specified in the char set [\-\\\/]

r = regex.compile(r"\b(?e)(?:\d{6,20}){i<=5:[\-\\\/]}\b")

This regex also matches 6-20 digit numbers with other punctuation, not just the ones I specified, like ':'


>>> s = "cat dog starting at 00:01132.000. hello world"

>>> r.search(s)

>>> <regex.Match object; span=(20, 28), match='00:01132', fuzzy_counts=(0, 1, 0)>

I’m using the May 2020 version on mac 10.15.4.

Comments (3)

  1. Log in to comment