re-pattern

functionsince v0.0-927 clojure.core/re-patternEdit
(re-pattern s)

Details:

Returns an instance of RegExp which has compiled the provided string.


Source docstring:
Returns an instance of RegExp which has compiled the provided string.
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn re-pattern
  [s]
  (if (instance? js/RegExp s)
    s
    (let [[prefix flags] (re-find #"^\(\?([idmsux]*)\)" s)
          pattern (subs s (if (nil? prefix)
                            0
                            (count ^string prefix)))]
      (js/RegExp. pattern (or flags "")))))