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

Add possessive wildcards to glob dictionaries (and change the default reluctant matching) #94

Closed
dweiss opened this issue Mar 15, 2021 · 0 comments

Comments

@dweiss
Copy link
Member

dweiss commented Mar 15, 2021

We need both possessive and reluctant wildcards in glob dictionaries to express rules like "anything with a trailing X":

* X

The above rule currently fails on inputs like:

Foo X X

because the first X matches the rule and there is a non-empty trailing substring.

Implementing exhaustive (greedy or reluctant) rules doesn't make much sense to me (and it can be easily abused) but I'll add support for both reluctant and possessive forms which express majority of the potential intentions and use cases. This will also change the default "" from reluctant to greedy and make "?" a reluctant equivalent to make it a bit more consistent with regular expressions. We will thus have the following glob "operators":

? - exactly one token
*? - zero or more tokens (reluctant)
* - zero or more tokens (possessive)
+? - one or more tokens (reluctant)
+ - one or more tokens (possessive)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant