From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Edward Dodge Newsgroups: gmane.emacs.help Subject: Re: end-of-line $ in multiline regexp replace Date: Fri, 31 Oct 2003 10:50:07 -0600 Organization: Confabulation Consulting Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1067619714 25437 80.91.224.253 (31 Oct 2003 17:01:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 31 Oct 2003 17:01:54 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 31 18:01:52 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AFcem-0001Hk-00 for ; Fri, 31 Oct 2003 18:01:52 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AFceO-0005Ri-Un for geh-help-gnu-emacs@m.gmane.org; Fri, 31 Oct 2003 12:01:28 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (darwin) Cancel-Lock: sha1:aGaf169iLwCrZ5veNEAUgbZqL8M= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 34 Original-Xref: shelby.stanford.edu gnu.emacs.help:117761 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:13697 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13697 "Leo" writes: > hi there > > want to replace a multiline regexp by an one-line replacement. (in fact i > just want to delete the line with the regexp.) > > so, at first i tried: > (query-replace-regexp ".*bytes.*$[ctrl-q][ctrl-j]" "" nil nil nil) > which did not find any line. :-( > > then i just tried the same without the end-of-line "$": > (query-replace-regexp ".*bytes.*[ctrl-q][ctrl-j]" "" nil nil nil) > and that worked. > > i don't understand, why? the first regexp ".*bytes.*$[ctrl-q][ctrl-j]" seems > to me even >>more valid<< then the second one. > > any explanations? > > tanks and cheers, leo The $ meta-character represents the very end of a line, which would include the newline character. Whereas C-q C-j is a regular expression for the newline character. My guess is that $ marks the very end of the line (INCLUDING the newline character) and so your regexp is actually the equivalent of this: ".*bytes.*[ctrl-q][ctrl-j][ctrl-q][ctrl-j]" -- Edward Dodge /GNU Emacs 21.3.50.1 (powerpc-apple-darwin5.5) of 2002-10-11 on G3/