From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: dkcombs@panix.com (David Combs) Newsgroups: gmane.emacs.help Subject: NTemacs: in NEGATED char-class, how to show newline? [^n]+ goes one too far. Date: 17 Feb 2010 15:14:28 -0500 Organization: PANIX -- Public Access Networks Corp. Message-ID: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1266439362 29717 80.91.229.12 (17 Feb 2010 20:42:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Feb 2010 20:42:42 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 17 21:42:38 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nhqig-0004OO-51 for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Feb 2010 21:42:02 +0100 Original-Received: from localhost ([127.0.0.1]:48590 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nhqif-0004fD-Np for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Feb 2010 15:42:01 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!bloom-beacon.mit.edu!panix!panix2.panix.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-NNTP-Posting-Host: panix2.panix.com Original-X-Trace: reader2.panix.com 1266437668 4764 166.84.1.2 (17 Feb 2010 20:14:28 GMT) Original-X-Complaints-To: abuse@panix.com Original-NNTP-Posting-Date: Wed, 17 Feb 2010 20:14:28 +0000 (UTC) Original-Xref: news.stanford.edu gnu.emacs.help:176841 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:71908 Archived-At: 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]+" "
  • " 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