From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Edi Weitz Newsgroups: gmane.emacs.help Subject: Re: delete text block with regexp Date: Mon, 17 Nov 2003 01:32:14 +0100 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <877k1zj0mp.fsf@bird.agharta.de> References: <873ccogor2.fsf@emacswiki.org> Reply-To: edi@agharta.de NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1069029947 13634 80.91.224.253 (17 Nov 2003 00:45:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 17 Nov 2003 00:45:47 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 17 01:45:45 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 1ALXWT-0002KS-00 for ; Mon, 17 Nov 2003 01:45:45 +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 1ALYTZ-0002Ba-Dy for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Nov 2003 20:46:49 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!trane.agharta.DE!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 24 Original-NNTP-Posting-Host: trane.agharta.de (62.159.208.82) Original-X-Trace: news.uni-berlin.de 1069029134 56216017 62.159.208.82 (16 [15706]) Mail-Copies-To: never User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:nuCZgj8YEkxR/bZd25C4ZqFHge4= Original-Xref: shelby.stanford.edu gnu.emacs.help:118356 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:14297 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:14297 On Sun, 16 Nov 2003 23:42:37 GMT, Stefan Monnier wrote: >> The critical part is that "." matches anything but a newline. >> Therefore use "\(.\|\n\)" for any character or a newline. > > Beware: such a regexp tends to suffer from the "regexp stack > overflow" problem. Better use \(.*\n\)*.* which is equivalent but > uses a lot less stack space. > > Sadly, to understand why you need to understand details of how the > regexp matching happens to be implemented in Emacs. Shouldn't a good regex implementation be able to optimize the problem away in simple cases like this? I've written a regex engine for Common Lisp which does transformations like (Perl syntax) * -> (?:*)? + -> * if includes register groups and is of fixed length. is an equivalent regular expression but without the register groups. I'm pretty sure Perl does something similar. Edi.