regex - How to replace forward slashes with backslashes in a string in Emacs Lisp? -
I would like to change the forward slash for backslashes in emacs lisp. If I use it:
(replace-regexp-in-string "\ /" \\ "path))
I get an error
(Invalid use of `\\ 'in the replacement text)"
How to represent backslash in another regexp?
What are you looking for in "C: \\ foo \\ bar"
/ P>
For example, if you string the length 1 with the backslash character, the textual presentation of the string "C: \ foo \ bar"
Do you:
(make-string 1? \\)
You get the following response (such as in the winbuffer, when you pick up CX CE Another way to get what you want is to switch the "literal" flag to:
(replace-regexp-in-string "/" "\\" path tt)
By the way, you do not have to avoid slash.
Comments
Post a Comment