i think I found a bug in clojure, can anyone explain why the backslash is missing from the output?
(clojure.string/replace "The color? is red." #"[?.]" #(str "zzz\\j" %1 %1))
=> "The colorzzzj?? is redzzzj.."
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This isn’t a bug. The string returned by the function in the 3rd parameter is parsed for escape sequences so that you can do things like this:
Notice how the first $ is escaped by the backslash, whereas the second serves as the identifier for a capture group. Change your code to use four backslashes and it works: