summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/platform/model/search_params.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/mattermost/platform/model/search_params.go')
-rw-r--r--vendor/github.com/mattermost/platform/model/search_params.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/vendor/github.com/mattermost/platform/model/search_params.go b/vendor/github.com/mattermost/platform/model/search_params.go
index 250c8e1f..1772c902 100644
--- a/vendor/github.com/mattermost/platform/model/search_params.go
+++ b/vendor/github.com/mattermost/platform/model/search_params.go
@@ -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, "#")