Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jplindstrom (594)

jplindstrom
  (email not shown publicly)

Journal of jplindstrom (594)

Tuesday May 24, 2005
09:49 AM

Emacs: Search-n-Replace with newlines

[ #24853 ]

Today's Emacs mystery solved: How do I indicate a newline when doing Search-n-Replace with e.g. M-%

At first I tried to quote the return key by typing C-q RET, but that replaced my text with ^M.

The first colleague I asked didn't know, but then came up with the idea to enter the ASCII code in octal: C-q 012 RET, and while that worked, it seems a bit silly (and I couldn't find the ascii table in Emacs, I'm positive it's there somewhere), surely a shortcut must be available for this.

The second colleague I asked didn't know, but then came up with this one: C-q C-j. This works fine and seems to be the correct solution.

Even knowing this it wasn't easy to Google for the correct solution, but I found this nice Emacs refcard that documents this.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.