help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NTemacs: in NEGATED char-class, how to show newline? [^n]+ goes one too


From: David Combs
Subject: NTemacs: in NEGATED char-class, how to show newline? [^n]+ goes one too far.
Date: 17 Feb 2010 15:14:28 -0500

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.



--- NEITHER OF THESE TWO STOP AT EOL -- KEEP GOING UNTIL EOF!

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

Here I added a line-feed, since windows uses crlf(?) as newline:

(query-replace-regexp "[^\\n\\j]+"     "BEGIN--\\&--END"      nil (if (and 
transient-mark-mode mark-active) (region-beginning)) (if (and 
transient-mark-mode mark-active) (region-end)))



MATCHES ONE TOO FAR: (query-replace-regexp "http://[^ \\t\\n]+"     "<LI><a 
href=\"\\&\"\\&<--LINK</a>"      nil (if (and transient-mark-mode mark-active) 
(region-beginning)) (if (and transient-mark-mode mark-active) (region-end)))


http://www.google.com/  <--- matches all of this,

http://www.google.com/  <---- PLUS the first char ("h") of this one.

http://www.google.com/

http://www.google.com/


Thanks!

David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]