From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Michael Slass Newsgroups: gmane.emacs.help Subject: Re: Newbie regexp question Date: Wed, 30 Oct 2002 17:24:21 GMT Organization: AT&T Broadband Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: <3DBFF5F8.B78A64CA@enea.se> <8765vkkkko.fsf@fbigm.here> <3DC00D40.B76302FD@enea.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1036002648 6768 80.91.224.249 (30 Oct 2002 18:30:48 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 30 Oct 2002 18:30:48 +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 186xc4-0001ka-00 for ; Wed, 30 Oct 2002 19:30:45 +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 186xcj-0001gO-00; Wed, 30 Oct 2002 13:31:25 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!news.gtei.net!newsfeed.mathworks.com!wn13feed!wn11feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc52.ops.asp.att.net.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-Lines: 38 Original-NNTP-Posting-Host: 12.228.27.239 Original-X-Complaints-To: abuse@attbi.com Original-X-Trace: rwcrnsc52.ops.asp.att.net 1035998661 12.228.27.239 (Wed, 30 Oct 2002 17:24:21 GMT) Original-NNTP-Posting-Date: Wed, 30 Oct 2002 17:24:21 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:106575 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:3125 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:3125 Paul Cohen writes: > >No that's not what I want. Let me rephrase in more general terms. I want to >remove a number of character sequences for which the following holds: > >1) They run over multiple lines. >2) They begin and end with well defined sequences of characters. (In my case >with "" and ""). Let's call the delimiting >character sequences for the start and and end token. >3) They may contain any number of unknown (printable) characters between the >start and end token. >4) There may exist multiple instances of these character sequences in the >file. > >/Paul > I think a lisp program would do better at this: VERY LIGHTLY TESTED. MAKE BACKUPS BEFORE EXPERIMENTING WITH THIS! (defun paulc-purge-html-test-sections (buffer) "Delete all occurances of text between and , inclusive." (interactive "bPurge html test sections in buffer: ") (save-excursion (save-restriction (goto-char (point-min)) (while (re-search-forward "" nil t) (let ((beg (match-beginning 0)) (end (progn (re-search-forward "" nil t) (match-end 0)))) (if end (kill-region beg end) (error "Unmatched \"\" sequence at position %d" beg))))))) -- Mike Slass