Single symbol in fuzzy match?

Create issue
Issue #202 wontfix
animalize created an issue

Just curious, can fuzzy matching see x{6} as a single symbol?

azb can match ab with fuzzy match, as expected:

>>> regex.search(r'(?:azb){e<=1}', 'ab')
<regex.Match object; span=(0, 2), match='ab', fuzzy_counts=(0, 0, 1)>

If I want to see x{6} as a single symbol, how to do it?
I tried Atomic Grouping, but it doesn't work.

>>> regex.search(r'(?:a(?>x{6})b){e<=1}', 'ab')
None

Comments (3)

  1. Matthew Barnett repo owner

    Regexes work with characters. You can't arbitrarily decide that a certain sequence of characters should be treated as a single symbol.

    Atomic grouping simply controls the backtracking, and nothing else.

    The only thing I can suggest is to do something like replace x{6} with a single character before processing.

  2. Log in to comment