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

Space toleration outside optional bracket #100

Open
htdinh opened this issue Jun 29, 2017 · 2 comments
Open

Space toleration outside optional bracket #100

htdinh opened this issue Jun 29, 2017 · 2 comments

Comments

@htdinh
Copy link
Contributor

htdinh commented Jun 29, 2017

The optional brackets accept multiple spaces between optional and main text (like between hello and (you|me) in 1st trigger). But if it happens that space is missing (likely an unnoticed typo), the matching for 2nd trigger will be how areyou and how areu, but NOT how are you.

+ hello           (you|me)
- hi

+ how are(you|u)
- i am fine
@htdinh
Copy link
Contributor Author

htdinh commented Jun 29, 2017

@kirsle What do you think about space tolerance for optionals?

@kirsle
Copy link
Member

kirsle commented Jun 29, 2017

This form should probably still work:

+ how are(you|u)
- i am fine

In that example it'd probably be a typo, but I could see users deliberately not including a space because they want to match multiple prefixes or suffixes on a word and don't want to have to repeat the entire word multiple times, like + fox(es|s) (it's too early in the morning to think of a better example 😉 ).

However, consolidating 2+ spaces in the trigger down to 1 space would sound reasonable. I couldn't imagine someone relying on the user needing to type 2+ spaces between words to match a trigger.

The regexp could be like re.sub(r'\)\s+', ') ', trigger) for every combination of \s+ touching the edge of a parenthesis symbol.

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