[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NTemacs: in NEGATED char-class, how to show newline? [^n]+ goes one
From: |
Jason Rumney |
Subject: |
Re: NTemacs: in NEGATED char-class, how to show newline? [^n]+ goes one too far. |
Date: |
Fri, 19 Feb 2010 07:47:02 -0800 (PST) |
User-agent: |
G2/1.0 |
On Feb 19, 11:40 pm, Jason Rumney <jasonrum...@gmail.com> wrote:
> On Feb 18, 4:14 am, dkco...@panix.com (David Combs) wrote:
>
> > subj: NTemacs: in NEGATED char-class, how to show newline? [^\n]+ goes one
> > too far.
>
> > Remember that this is "ntemacs" (google it, you'll see), running under
> > WINDOWS xp, where line-ends are the old DEC crlf.
>
> Emacs uses LF line ends internally, converting on read and write
> (unless you explicitly use binary or *-unix as your coding system).
>
> > (query-replace-regexp "[^\\n]+" "BEGIN--\\&--END" nil (if (and
> > transient-mark-mode mark-active) (region-beginning)) (if (and
> > transient-mark-mode mark-active) (region-end)))
>
> Does the following work any better?
>
> (query-replace-regexp ".+$" "BEGIN--\\&--END" ...)
Also, try M-x regexp-builder to see in real-time what your regexp will
select.
My guess is that there are no n or \ characters in your buffer, and
you've escaped the backslash in a context where it doesn't need
escaping.