From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.help Subject: Re: regexp and strings you don't want Date: Fri, 29 Aug 2003 18:14:24 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <6c185cf3.0308251145.6af55ffc@posting.google.com> <844r02luds.fsf@slowfox.is.informatik.uni-duisburg.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1062175175 24298 80.91.224.253 (29 Aug 2003 16:39:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 29 Aug 2003 16:39:35 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 29 18:39:33 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 19smHd-0005F0-00 for ; Fri, 29 Aug 2003 18:39:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 19smHL-0006Aw-My for geh-help-gnu-emacs@m.gmane.org; Fri, 29 Aug 2003 12:39:15 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!dialin-145-254-133-230.arcor-ip.NET!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-NNTP-Posting-Host: dialin-145-254-133-230.arcor-ip.net (145.254.133.230) Original-X-Trace: news.uni-berlin.de 1062173720 12117586 145.254.133.230 (16 [87814]) X-Attribution: os X-Face: "HgH2sgK|bfH$; PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6; Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (windows-nt) Cancel-Lock: sha1:4DFAgTSqN3ilcIwJr4Wb5Xc+XMY= Original-Xref: shelby.stanford.edu gnu.emacs.help:116255 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:12173 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:12173 kai.grossjohann@gmx.net (Kai Großjohann) writes: > chaz2@thedoghousemail.com (Chaz) writes: > >> For example, how can I search for a paragraph beginning with "The" >> that does NOT include the word "top"? > > It is possible to build a regexp that does this (disregarding the > paragraph problem at the moment), but it is not pretty. > > Some regexp implementations have the feature you're looking for to > make it convenient, but the Emacs implementation doesn't. > > Let me rephrase this in terms of lines instead of paragraphs. > > The idea is this: search for a line that begins with The and then > does not have top after it, as follows: after The, we allow any > characters that aren't t. We also allow a t followed by something > that's not o, and also a to that's followed by something that's not > p. And so on: > > "^The\\([^t]*\\($\\|t$\\|t[^o]\\|to$\\|to[^p]\\)\\)*$" Hmm. This is not really human readable. Would it be hard and/or bad to extend `rx' so that it allows for (not STRING)? A là: (looking-at (rx (and line-start "The " (not "top")))) Whereas `(not "top")' would compile to a normal regexp in the way you described it. WDYT? Oliver -- 12 Fructidor an 211 de la Révolution Liberté, Egalité, Fraternité!