"ozark" <[EMAIL PROTECTED]> writes:

> Some of the lines in the buffer have only the single character '#' in
> them. I want to remove all such lines.
> I tried doing the following:
>
> M-x replace-regexp ^#$<RET><RET>
> This replaces the lines with # in them by blank lines. As this is not I
> want, I undid that, and instead tried
>
> M-x replace-regexp ^#$C-qC-j<RET><RET>
> This just says "Replaced 0 occurrences" and does nothing. Why is this
> so? (I also tried C-m instead of C-j, it doesn't work either. I'm using
> Linux)

Leave off the $.  It is described in

(info "(emacs)Regexps")

`$'
     is similar to `^' but matches only at the end of a line.  Thus,
     `x+$' matches a string of one `x' or more at the end of a line.

     For historical compatibility reasons, `$' can be used with this
     meaning only at the end of the regular expression, or before `\)'
     or `\|'.

And the C-q C-j is quite enough to match the end of line.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to