unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jai Dayal <dayalsoap@gmail.com>
To: Marko Vojinovic <vvmarko@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Beginner trouble with regexp matching
Date: Sat, 29 Oct 2011 10:25:36 -0400	[thread overview]
Message-ID: <CAMJ-YiTCX_MGThmvQ71aYrehkN=ejLZYeh_fRtD_S_SW129zfQ@mail.gmail.com> (raw)
In-Reply-To: <201110291522.46464.vvmarko@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]

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
>
>
>

[-- Attachment #2: Type: text/html, Size: 1515 bytes --]

  reply	other threads:[~2011-10-29 14:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-29 14:22 Beginner trouble with regexp matching Marko Vojinovic
2011-10-29 14:25 ` Jai Dayal [this message]
2011-10-29 14:41   ` Marko Vojinovic
2011-10-29 15:00     ` Drew Adams

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='CAMJ-YiTCX_MGThmvQ71aYrehkN=ejLZYeh_fRtD_S_SW129zfQ@mail.gmail.com' \
    --to=dayalsoap@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=vvmarko@gmail.com \
    /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).