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: How, in a QUERY-REPLACE-regexp, to match a RANGE of lines? Date: 17 Feb 2010 15:22:19 -0500 Organization: PANIX -- Public Access Networks Corp. Message-ID: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1266439407 29953 80.91.229.12 (17 Feb 2010 20:43:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Feb 2010 20:43:27 +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:43:25 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 1Nhqjb-0005mr-Rd for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Feb 2010 21:43:00 +0100 Original-Received: from localhost ([127.0.0.1]:49166 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nhqjb-0005CT-Be for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Feb 2010 15:42:59 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!panix!panix2.panix.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 46 Original-NNTP-Posting-Host: panix2.panix.com Original-X-Trace: reader2.panix.com 1266438139 899 166.84.1.2 (17 Feb 2010 20:22:19 GMT) Original-X-Complaints-To: abuse@panix.com Original-NNTP-Posting-Date: Wed, 17 Feb 2010 20:22:19 +0000 (UTC) Original-Xref: news.stanford.edu gnu.emacs.help:176842 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:71909 Archived-At: subj: How, in a QUERY-REPLACE-regexp, to match a RANGE of lines? Like from a line containing xxx up through the nearest one containing yyy? Totally separate question: (Any easy way to give error msg if you see another xxx-line before that yyy? -- other than by explicit loop looking at each line and remembering what it saw?) Or do you have to write an explicit loop -- checking each individual line, remembering what you've seen so far (eg, xxx), etc. In elisp, how would you do that? Thanks, David PS: reason for this: I've got a bunch of Amazon reviews (hundreds of them), each containing these six lines: | Help other customers find the most helpful reviews | Was this review helpful to you? Yes No | | | Report this | Permalink | Comment Comment But, now and then, I might have already removed any one or more of them. So I got to make sure it's as I think it is. Any way to recognize those six lines with ONE regexp?