help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Easy regexp issue


From: Kevin Rodgers
Subject: Re: Easy regexp issue
Date: Fri, 19 Jan 2007 00:28:21 -0700
User-agent: Thunderbird 1.5.0.9 (Macintosh/20061207)

HS wrote:
I'm finding this quite odd:
I want to replace all slashes for backslashes in a string, but i'm
having trouble!

Running this:
(replace-regexp-in-string "/" "\\" "c:/emacs/lisp/")
I get:
Debugger entered--Lisp error: (error "Invalid use of `\\' in
replacement text")

And if I try:
(replace-regexp-in-string "/" "\" "c:/emacs/lisp/")
I get:
Debugger entered--Lisp error: (scan-error "Unbalanced parentheses" 302
1)

So, I don't see any other options!
I know the problems is there because I replace for another string then
it works:
(replace-regexp-in-string "/" "x" "c:/emacs/lisp/")
"c:xemacsxlispx"

See the LITERAL argument in the doc string for replace-regexp-in-string:

(replace-regexp-in-string "/" "\\" "c:/emacs/lisp/" nil t)

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

[Prev in Thread] Current Thread [Next in Thread]