summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorHyeseong Kim <cometkim.kr@gmail.com>2016-11-24 23:38:56 +0900
committerJoram Wilander <jwawilander@gmail.com>2016-11-24 09:38:56 -0500
commit2abcc25173ef40b29cdde28856a3f5c9234056d3 (patch)
tree1a94ee38e5f3827e9fed61c4e70e2f0be57f7708 /model
parent981ea33b8e10456bc279f36235c814305d01b243 (diff)
downloadchat-2abcc25173ef40b29cdde28856a3f5c9234056d3.tar.gz
chat-2abcc25173ef40b29cdde28856a3f5c9234056d3.tar.bz2
chat-2abcc25173ef40b29cdde28856a3f5c9234056d3.zip
PLT-2077 Support CJK hashtags (#4555)
* Add Korean character ranges to exist CJK pattern * Add constant for CJK hashtags Becuase most of keywords in CJK are two characters * Add CJK ranges to hashtag pattern to handle it. * Fixes hashtag pattern to apply numbers at last * Remove a wrong test case `test_` shouldn't be a hashtag * Fix hashtag regex to support standard unicodes * Remove wrong escapes from regex
Diffstat (limited to 'model')
-rw-r--r--model/utils.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/model/utils.go b/model/utils.go
index 457b64c09..0ce243fe7 100644
--- a/model/utils.go
+++ b/model/utils.go
@@ -304,7 +304,7 @@ func Etag(parts ...interface{}) string {
return etag
}
-var validHashtag = regexp.MustCompile(`^(#[A-Za-zäöüÄÖÜß]+[A-Za-z0-9äöüÄÖÜß_\-]*[A-Za-z0-9äöüÄÖÜß])$`)
+var validHashtag = regexp.MustCompile(`^(#\pL[\pL\d\-_.]*[\pL\d])$`)
var puncStart = regexp.MustCompile(`^[^\pL\d\s#]+`)
var hashtagStart = regexp.MustCompile(`^#{2,}`)
var puncEnd = regexp.MustCompile(`[^\pL\d\s]+$`)