I'm looking to implement seperate-humps in clojurescript but there is no re-matcher or re-groups. Is there an alternative method?
(defn re-sub
[^String value pattern sub-func]
(loop [matcher (re-matcher pattern value)
result []
last-end 0]
(if (.find matcher)
(recur matcher
(conj result
(.substring value last-end (.start matcher))
(sub-func (re-groups matcher)))
(.end matcher))
(apply str (conj result (.substring value last-end))))))
(defonce +hump-pattern+ #"[a-z0-9][A-Z]")
(defn separate-humps
[^String value]
(re-sub value +hump-pattern+ #(string/join " " (seq %))))
(separate-humps "aTaTa")
;;=> "a Ta Ta"