Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is intended to improve the success rate for the automatic detection of thanks by adjusting the regex to match more reliably around punctuation.
The current thanks detection regex...
(?i)( |\n|^)(thanks?\pP*|danks|ty|thx|\+rep|\+ ?\<\@[0-9]*\>)( |\n|$)
...misses several variants of "thanks" due to how the regex will only match if punctuation followed
thanks
but not other variants likety
andthx
.The improved thanks detection regex...
(?i)( |\n|^)?(thanks?|danks|ty|thx|\+rep|\+ ?\<\@[0-9]*\>)( |\pP|\n|$)
...will additionally catch variants like
ty
andthx
when there is trailing punctuation.Note: Matching on "danks" was not added by this PR; this variant was already in the regex when I found it. Although this has generated questions and skepticism with people whom I have asked to review the regex, I have left it in there.
The change has been tested using regex101.com's interactive tool for Golang-flavored regular expressions.
Before:
After: