(defn read-regex
[rdr ch opts pending-forms]
(let [sb (StringBuilder.)]
(loop [ch (read-char rdr)]
(if (identical? \" ch)
(Pattern/compile (str sb))
(if (nil? ch)
(err/throw-eof-reading rdr :regex sb)
(do
(.append sb ch )
(when (identical? \\ ch)
(let [ch (read-char rdr)]
(if (nil? ch)
(err/throw-eof-reading rdr :regex sb))
(.append sb ch)))
(recur (read-char rdr))))))))