From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: lawrence mitchell Newsgroups: gmane.emacs.help Subject: Re: replace-regexp question Date: Mon, 02 Jun 2003 12:53:29 +0100 Organization: funfunfun Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1054555020 23290 80.91.224.249 (2 Jun 2003 11:57:00 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 2 Jun 2003 11:57:00 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 02 13:56:58 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19MnvW-00062G-00 for ; Mon, 02 Jun 2003 13:56:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Mnut-0001DM-7N for gnu-help-gnu-emacs@m.gmane.org; Mon, 02 Jun 2003 07:55:55 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!vegetable.demon.co.UK!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 25 Original-NNTP-Posting-Host: vegetable.demon.co.uk (80.177.16.3) Original-X-Trace: fu-berlin.de 1054554809 9288163 80.177.16.3 (16 [97657]) X-No-Yes: No Mail-Copies-To: nobody User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 Cancel-Lock: sha1:0YztGXAkB64eEi6QABBLcm9jzLA= Original-Xref: shelby.stanford.edu gnu.emacs.help:113978 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:10472 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:10472 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