4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-28 17:19:24 +00:00

Sync with mattermost 3.1.0

This commit is contained in:
Wim
2016-06-23 20:28:05 +02:00
parent e48db67649
commit 6ec77e06ea
22 changed files with 1237 additions and 556 deletions

View File

@ -4,9 +4,13 @@
package model
import (
"regexp"
"strings"
)
var searchTermPuncStart = regexp.MustCompile(`^[^\pL\d\s#"]+`)
var searchTermPuncEnd = regexp.MustCompile(`[^\pL\d\s*"]+$`)
type SearchParams struct {
Terms string
IsHashtag bool
@ -91,8 +95,8 @@ func parseSearchFlags(input []string) ([]string, [][2]string) {
if !isFlag {
// trim off surrounding punctuation (note that we leave trailing asterisks to allow wildcards)
word = puncStart.ReplaceAllString(word, "")
word = puncEndWildcard.ReplaceAllString(word, "")
word = searchTermPuncStart.ReplaceAllString(word, "")
word = searchTermPuncEnd.ReplaceAllString(word, "")
// and remove extra pound #s
word = hashtagStart.ReplaceAllString(word, "#")