                           (> x z) z
                           (< x a) a
                           :else x))
-            query (second (re-matches #"(?:.|\n)*#(\S*)" text))
+            query ((get-in engines [0 :matcher]) text)
             results ((get-in engines [0 :results]) query (config :thread-id))
             highlight-next!
             (fn []

(def engines
  [
   {:pattern #"(?:.|\n)*#(\S*)"
    :results (fn [query thread-id]
               (when query
                 (let [thread-tag-ids (-> (store/id->thread thread-id)

    (not= -1 (.indexOf (normalize s) (normalize m)))))



; matcher - fn that determines if engine is to be used, returns text to use
;    inputs:
;        text - current text of user's message
;    outputs
;        string containing matched text OR nil
; results - fn that returns results that will be shown if pattern matches
;    inputs:
;       query - is the partial text that was matched
