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

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

Re: Beginner trouble with regexp matching


From: Jai Dayal
Subject: Re: Beginner trouble with regexp matching
Date: Sat, 29 Oct 2011 10:25:36 -0400

New lines with replace-string in emacs are a little bit..... random. 

M-x replace-string  then type \\begin{equation}
then, instead of typing \n, use the key stroke C-q C-j

That should enter the newline as emacs knows it.

On Sat, Oct 29, 2011 at 10:22 AM, Marko Vojinovic <vvmarko@gmail.com> wrote:

Hi foks! :-)

Sorry if this question is maybe too trivial, but google wasn't my friend
today. :-(

I am editing a TeX file, and I want to search for "\begin{equation} " (with the
blank space at the end and without quotes), and to add the newline at the end
instead of the blank space. So the obvious way to do it appeared to be to
perform a regexp replacing from

 \\begin{equation}

(which finishes with a space) to

 \\begin{equation}\n

However, this doesn't work --- Emacs correctly matches the first string, but
fails to replace it with the second, with an error "Invalid use of `\' in
replacement text".

This is my very first try to use regular expressions for search&replace, and I
am still learning. What am I doing wrong?

TIA, :-)
Marko




reply via email to

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