Browse Source

dictionary: Rewrite how the regex to match terms gets constructed

Will Storey 8 năm trước cách đây
mục cha
commit
107e34a1c9
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 4 3
      dictionary.tcl

+ 4 - 3
dictionary.tcl

@@ -277,11 +277,12 @@ proc ::dictionary::is_addressing_bot {text botnick} {
 # hitest
 proc ::dictionary::string_contains_term {s term} {
   set term_lc [string tolower $term]
-
   set term_quoted [::dictionary::quotemeta $term_lc]
 
-  # \m matches at the beginning of a word, \M at the end.
-  return [regexp -nocase -- \\m$term_quoted\\M $s]
+  set re {\m}
+  append re $term_quoted
+  append re {\M}
+  return [regexp -nocase -- $re $s]
 }
 
 # Escape/quote metacharacters so that the string becomes suitable for placing in