Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For Fuzzy Matching, it is impossible to specify a test character set for both insertion and substitution at the same time. #487

Open
Ptolemy2002 opened this issue Jan 8, 2023 · 2 comments

Comments

@Ptolemy2002
Copy link

Ptolemy2002 commented Jan 8, 2023

A pattern such as this compiles:
(?:hello){s<=2,d<1,e<=3,i<=2:\d}

but the same pattern with a substitution character set added does not:
(?:hello){d<1,e<=3,i<=2:[\d],s<=2:[a-zA-Z]}

The error message is:

expected } at position 28`

The computer seems to expect a closing brace immediately after the specification of a character set, which means that you can only specify one character set, and it has to be at the end of the quantifier. I'm unsure if this is a bug or purposeful, but I can't see why the process should be restricted to one or the other.

@mrabarnett
Copy link
Owner

The additional test was requested in issue #338. It applies to both the insertions and the substitutions, so in (?:hello){s<=2,d<1,e<=3,i<=2:\d} the \d applies to both the s and the i. (Changing that would break existing code.) You're the first person who has requested the ability to have separate tests for insertions and substitutions.

@Ptolemy2002
Copy link
Author

It applies to both the insertions and the substitutions

I didn't know this. Reading the documentation, I misunderstood the text "You can add a test to perform on a character that's substituted or inserted." Maybe that should be updated to be slightly more clear?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants