I earned by doubling everything. Oh, the joys of double escape.
=> (re-pattern "\\)\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)")
=>
=> (re-find (re-pattern "\\)\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)")
")!@#$%^&*()")
=> ")!@#$%^&*()"
str-to-pattern ( , ), , , re-pattern .
:
, - . , . "Smap" , , " " " ", " " smap " ", vals of smap. smap {\( "\\(", \) "\\)" ...}.
(def regex-char-esc-smap
(let [esc-chars "()*&^%$#!"]
(zipmap esc-chars
(map
- . smap , . , ->> , .
(defn str-to-pattern
[string]
(->> string
(replace regex-char-esc-smap)
(reduce str)
re-pattern))