From 37854299488e47a7eac818e577c65e9431501b46 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 17 Nov 2017 14:37:31 -0500 Subject: [PATCH] FIX: Missing word boundaries when non-regexp --- app/services/word_watcher.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/word_watcher.rb b/app/services/word_watcher.rb index b9b48761ae3..ff82f36bd55 100644 --- a/app/services/word_watcher.rb +++ b/app/services/word_watcher.rb @@ -19,7 +19,7 @@ class WordWatcher nil else regexp = '(' + words.map { |w| word_to_regexp(w) }.join('|'.freeze) + ')' - SiteSetting.watched_words_regular_expressions? ? regexp : "(#{regexp})" + SiteSetting.watched_words_regular_expressions? ? regexp : "\\b(#{regexp})\\b" end end s.present? ? Regexp.new(s, Regexp::IGNORECASE) : nil