From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: Newbie regexp question Date: Wed, 30 Oct 2002 16:49:40 GMT Organization: Genuity, Woburn, MA Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: <3DBFF5F8.B78A64CA@enea.se> <8765vkkkko.fsf@fbigm.here> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1036002438 5656 80.91.224.249 (30 Oct 2002 18:27:18 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 30 Oct 2002 18:27:18 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 186xYi-0001T4-00 for ; Wed, 30 Oct 2002 19:27:16 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 186xZX-0000V3-00; Wed, 30 Oct 2002 13:28:07 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn11feed!wn12feed!worldnet.att.net!4.24.21.153!chcgil2-snh1.gtei.net!crtntx1-snh1.gtei.net!news.gtei.net!paloalto-snr1.gtei.net.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Mail-Copies-To: never X-Newsreader: trn 4.0-test72 (19 April 1999) Originator: barmar@genuity.net (Barry Margolin) Original-Lines: 43 Original-X-Trace: +r4CDg2PSPVh6klozscekb5/ptqqcTYnjwNvwnSDVB4hNMn6Ij9CQuUtXjDjHeSod4rfjsBbxXKr!FskJezjvWdM7kXqPoqQGYOox0KrNE6gVfSp/clUDmErLHUBVe9Zq/bgFJuOMvm5dmlSQUW11YDvU!M5uxzAtaS3jvVg== Original-X-Complaints-To: abuse@gte.net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly Original-NNTP-Posting-Date: Wed, 30 Oct 2002 16:49:40 GMT Original-Distribution: world Original-Xref: shelby.stanford.edu gnu.emacs.help:106573 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:3124 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:3124 In article <8765vkkkko.fsf@fbigm.here>, Friedrich Dominicus wrote: >Paul Cohen writes: > >> Hi >> >> I want to do a Emacs regexp search and replace on a HTML file containing >> patterns like this: >> >> >> ... >> >> >> Where "..." denotes a variable number of lines of HTML text. >> >> I want to search for all occurrences of the above pattern and then >> remove them from the HTML file! >> >> I've tried a number of variants without any success. For example the >> following regexp doesn't work: >> >> \(.*\n\)* >I would restate the problem. It does not make much sense to me to >match over a bunch of lines you do not want to handle. > >So how about >M-C-% ^[ \t]* with: RET This removed the and lines, but it doesn't remove all the lines in between, which I think is his real goal. The problem with the OP's attempted solution is that * is greedy. So it will match everything from the first to the last , including all the non-test stuff in between. I would do this using a keyboard macro that searches for , sets a mark, searches for , and then kills the region. -- Barry Margolin, barmar@genuity.net Genuity, Woburn, MA *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups. Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.