diff options
author | guillep2k <18600385+guillep2k@users.noreply.github.com> | 2019-11-09 19:12:05 -0300 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-11-09 17:12:05 -0500 |
commit | bb04fb55d75242c71a131998565a567e193a3d8c (patch) | |
tree | 41ebe5596ca64040cc725fe64a21efeca025345a /modules/references/references.go | |
parent | c54145174fba9d43b75b9f0d3f580bb02e69e6ee (diff) | |
download | gitea-bb04fb55d75242c71a131998565a567e193a3d8c.tar.gz gitea-bb04fb55d75242c71a131998565a567e193a3d8c.zip |
Enable punctuations ending mentions (#8889)
* Enable punctuations ending mentions
* Improve tests
Diffstat (limited to 'modules/references/references.go')
-rw-r--r-- | modules/references/references.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/references/references.go b/modules/references/references.go index 58a8da2895..af0fe1aa0d 100644 --- a/modules/references/references.go +++ b/modules/references/references.go @@ -27,7 +27,7 @@ var ( // TODO: fix invalid linking issue // mentionPattern matches all mentions in the form of "@user" - mentionPattern = regexp.MustCompile(`(?:\s|^|\(|\[)(@[0-9a-zA-Z-_\.]+)(?:\s|$|\)|\])`) + mentionPattern = regexp.MustCompile(`(?:\s|^|\(|\[)(@[0-9a-zA-Z-_]+|@[0-9a-zA-Z-_][0-9a-zA-Z-_.]+[0-9a-zA-Z-_])(?:\s|[:,;.?!]\s|[:,;.?!]?$|\)|\])`) // issueNumericPattern matches string that references to a numeric issue, e.g. #1287 issueNumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[)(#[0-9]+)(?:\s|$|\)|\]|:|\.(\s|$))`) // issueAlphanumericPattern matches string that references to an alphanumeric issue, e.g. ABC-1234 |