Reputation: 1379
I would like to do something like that:
(def my_regex #"[1-9]")
(extract-string my-regex)
=> "[1-9]"
Is it possible in clojure?
Upvotes: 1
Views: 281
Reputation: 51500
It's easy:
(.toString my_regex)
Actually, all Java
(and Clojure
) objects have .toString
method returning its string representation.
There is also a str
function in Clojure, which calls .toString
on each of its arguments and concatenates results:
(str my_regex)
So, it's doing the same thing, but it's pure Clojure.
Upvotes: 4