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

rule: $nick in regex pattern is confusing #1885

Closed
Exirel opened this issue Jun 6, 2020 · 0 comments · Fixed by #1920
Closed

rule: $nick in regex pattern is confusing #1885

Exirel opened this issue Jun 6, 2020 · 0 comments · Fixed by #1920

Comments

@Exirel
Copy link
Contributor

Exirel commented Jun 6, 2020

The problem

When using sopel.module.rule, you can have the variable $nick in the regex pattern:

r'$nickhello' # will match "Bot: hello"
r'$nick hello' # won't match "Bot: hello", but "Bot:  hello" (two spaces)

The $nick variable is super confusing as it should probably accept \s* instead of \s+ so a pattern like r'$nick hello' would be way easier to read and be less prone to error.

The solution

I don't know yet. Is \s* an acceptable change? Do we need to wait until Sopel 8 for that?

Notes

More documentation about these variables is required. Also this comes from a review by @dgw on #1873 where he points out that my comment should be more visible, and not just in a corner of the test suite.

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

Successfully merging a pull request may close this issue.

1 participant