[PLUG] Emacs regex: Replace W/Original String

wes plug at the-wes.com
Tue Apr 26 21:58:32 UTC 2011


On Tue, Apr 26, 2011 at 10:45 AM, Rich Shepard <rshepard at appl-ecosys.com>wrote:

> On Tue, 26 Apr 2011, Rogan Creswick wrote:
>
> > I believe that $ just matches end-of-line.
>
> Rogan,
>
>   Yes, that's correct.
>
> > Inserting a new-line is trickier (which is why my example used 'foo'
> > instead.) I think you can get a newline character with: C-q <enter>,
> which
> > should leave you with a single character that looks like ^M.
>
>    Apparently, it's C-q C-j, but I'm not sure how to correctly enter these.
> The ^M is the DOS end-of-line; in emacs the result should be the following
> text moves to the beginning of the next line. I'm still searching.
>
> Thanks,
>
> Rich
>


I do this in vi all the time. It shows a ^M in the search/replace string,
but not in the actual text that got modified.

^M shows at newlines in the text when viewing DOS-formatted files in Linux.
This is a separate, unrelated thing.

-wes



More information about the PLUG mailing list