I have created a regular expression with re-builder in Emacs. I use C-c C-w to copy it to the kill-ring.
The kill-ring shows:
"\\(defun\\)"
First, I modified the copy function to get rid of the "".
\\(defun\\)
My other problem is, the regex in the kill-ring contains double backslashes, rendering it unusable for functions like query-replace-regexp, which I want to yank it back into from the kill-ring.
These functions expect single backslashes, like
\(defun\)
So I thought I could replace the '\\' with the '\' before copying it to the kill-ring by doing this:
(replace-regexp-in-string "\\\\" "\\" "\\(defun\\)" nil t)
When executing the function the minibuffer shows "\\(defun\\)" instead of "\(defun\)" as a result.
What am I doing wrong?