From: lawrence mitchell <wence@gmx.li>
Subject: Re: replace-regexp question
Date: Mon, 02 Jun 2003 12:53:29 +0100 [thread overview]
Message-ID: <?fnord?87fzmssnk6.fsf@ID-97657.usr.dfncis.de> (raw)
In-Reply-To: bbfbvu$dvl$1@gladiola.noc.ucla.edu
Chang Luo wrote:
> I want to replace regexp "a$" to "a$b$c$". how to do that?
> i.e. I want:
> a -> a
> b
> c
> But replace-regexp gives me:
> a -> a$b$c$
"$" is only a special character in regexps in the search string
(not the replace string). Hence, you want to do something like
(replace-regexp "a$" "a\nb\nc\n"). If doing this interactively,
"\n" is also interpreted literally. So you have to insert an
literal newline, using C-q C-j, e.g. the interactive key
sequence would be:
M-x replace-regexp RET a $ RET a C-q C-j b C-q C-j c C-q C-j RET
hope the clears that up a bit.
--
lawrence mitchell <wence@gmx.li>
next prev parent reply other threads:[~2003-06-02 11:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-02 11:21 replace-regexp question Chang Luo
2003-06-02 11:53 ` lawrence mitchell [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-10-26 17:15 Neon Absentius
[not found] <mailman.12812.1130346970.20277.help-gnu-emacs@gnu.org>
2005-10-26 17:34 ` David Kastrup
2005-10-26 18:24 ` Giorgos Keramidas
2005-10-26 19:52 ` David Kastrup
2005-10-27 9:01 ` Harald Hanche-Olsen
2005-10-27 9:32 ` David Kastrup
2005-10-27 11:47 ` Neon Absentius
2005-10-27 14:38 ` Sébastien Kirche
2005-10-27 15:08 ` David Kastrup
2005-10-27 17:24 ` Sébastien Kirche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='?fnord?87fzmssnk6.fsf@ID-97657.usr.dfncis.de' \
--to=wence@gmx.li \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).