[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
replace-match and backslashes
From: |
Alex Schroeder |
Subject: |
replace-match and backslashes |
Date: |
14 Apr 2001 14:17:20 +0200 |
User-agent: |
Gnus/5.090001 (Oort Gnus v0.01) Emacs/20.7 |
In GNU Emacs 20.7.1 (i686-pc-linux-gnu, X toolkit)
of Sun Apr 8 2001 on snail
When evaluating either of the following two expressions, I get the
error "Invalid use of `\' in replacement text", eventhough "\\" is
documented as "`\\' stands for a single `\' in the replacement text."
This is either a bug in the documentation or a bug in replace-match.
This is supposed to return "--\--":
(progn (string-match "ga" "--ga--")
(replace-match "\\" nil nil "--ga--"))
This is supposed to replace the "ga" in the comment with a single
backslash:
(progn (re-search-forward "ga")
(replace-match "\\"))
;; "--ga--"
The following works -- the expression returns "--\\--". I just can't
get it to work with /one/ backslash in the replacement text.
(progn (string-match "ga" "--ga--")
(replace-match "\\\\" nil nil "--ga--"))
Alex.
- replace-match and backslashes,
Alex Schroeder <=