Updated serverside hashtag regex to ignore more punctuation around words

Этот коммит содержится в:
hmhealey
2016-01-25 16:47:49 -05:00
родитель ab5425f9b9
Коммит 97ede2a428
4 изменённых файлов: 54 добавлений и 25 удалений

Просмотреть файл

@@ -20,12 +20,7 @@ func splitWordsNoQuotes(text string) []string {
words := []string{}
for _, word := range strings.Fields(text) {
word = puncStart.ReplaceAllString(word, "")
word = puncEnd.ReplaceAllString(word, "")
if len(word) != 0 {
words = append(words, word)
}
words = append(words, word)
}
return words
@@ -94,7 +89,16 @@ func parseSearchFlags(input []string) ([]string, [][2]string) {
}
if !isFlag {
words = append(words, word)
// trim off surrounding punctuation
word = puncStart.ReplaceAllString(word, "")
word = puncEnd.ReplaceAllString(word, "")
// and remove extra pound #s
word = hashtagStart.ReplaceAllString(word, "#")
if len(word) != 0 {
words = append(words, word)
}
}
}