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

Don't match /close as part of other text #226

Merged
merged 2 commits into from
Dec 10, 2023
Merged

Don't match /close as part of other text #226

merged 2 commits into from
Dec 10, 2023

Conversation

timja
Copy link
Owner

@timja timja commented Dec 10, 2023

Fixes #225

@@ -3,7 +3,9 @@ export function transferMatcher(text) {
}

export function closeMatcher(text) {
return text.match(/(?:^| | \r\n|\n)\/close (not-planned)|\/close/);
return text.match(
/(?:^| | \r\n|\n)\/close (not-planned)|(?:^| | \r\n|\n)\/close/
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the bug was introduced because it was trying not to match /closenot-planned which in the naïve regex of:

/(?:^| | \r\n|\n)\/close ?(not-planned)?/

would match, there's probably a simpler fix than this but I'm not aware of it.

I checked all other matchers and this is the only one with the issue

@timja timja added the bug Something isn't working label Dec 10, 2023
@timja timja enabled auto-merge (squash) December 10, 2023 21:47
@timja timja merged commit 79448bc into main Dec 10, 2023
3 checks passed
@timja timja deleted the fix-close branch December 10, 2023 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't react to command if they're part of a larger text
1 participant