From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.help Subject: Re: RegExp: match everything except a certain string Date: Tue, 20 Nov 2007 22:05:42 +0100 Message-ID: <47434C26.1090208@gmail.com> References: <87fxz0j3wc.fsf@kamaloka.dhatu> <200711201850.02854.andreas.roehler@online.de> <87wssc7iz3.fsf@kamaloka.dhatu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1195592819 7127 80.91.229.12 (20 Nov 2007 21:06:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 20 Nov 2007 21:06:59 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Sven Bretfeld Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 20 22:07:05 2007 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.50) id 1IuaIZ-0001AT-VL for geh-help-gnu-emacs@m.gmane.org; Tue, 20 Nov 2007 22:06:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IuaIM-0001oq-3y for geh-help-gnu-emacs@m.gmane.org; Tue, 20 Nov 2007 16:06:10 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IuaHz-0001gs-Fh for help-gnu-emacs@gnu.org; Tue, 20 Nov 2007 16:05:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IuaHx-0001gV-Sg for help-gnu-emacs@gnu.org; Tue, 20 Nov 2007 16:05:47 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IuaHx-0001gS-Je for help-gnu-emacs@gnu.org; Tue, 20 Nov 2007 16:05:45 -0500 Original-Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IuaHx-0000io-0T for help-gnu-emacs@gnu.org; Tue, 20 Nov 2007 16:05:45 -0500 Original-Received: from c83-254-148-228.bredband.comhem.se ([83.254.148.228]:61027 helo=[127.0.0.1]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1IuaHu-0003MB-6O; Tue, 20 Nov 2007 22:05:43 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 In-Reply-To: <87wssc7iz3.fsf@kamaloka.dhatu> X-Antivirus: avast! (VPS 071120-0, 2007-11-20), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.148.228 X-Scan-Result: No virus found in message 1IuaHu-0003MB-6O. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1IuaHu-0003MB-6O c2c57cd2a1fe899161901a71ed6bfbc6 X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) 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:49374 Archived-At: Sven Bretfeld wrote: > Hello Andreas > > Andreas Röhler writes: > >>> author = {somename}, >>> editor = {}, >>> title = {sometitle}, >>> subtitle = {}, >>> series = {}, >>> url = {} >>> >>> I want to find a regexp that matches every line with empty {} except >>> of the "subtitle line". I've come that far: >>> >> Got it with: >> >> [^s]?[^u]?[^b]?[^t]?[^i]?[^t]?[^l]?[^e] = {},?$ >> >> Please don't ask why :) > > That's working. Thanks. (I don't ask.) > >> Anyway--you will know that and it's not the precise >> answer-- it might be useful to point at >> >> M-x shell-command-on-region >> >> grep {} | sed /subtitle/d >> >> as an easy-to-use solution. > > It's a good idea to use a sed pipe. But it doesn't matter how much > there is to type, since I need the expression for a function. So I > only have to type it once. Then it is probably much easier to use two step aproach: 1) use a simpler regexp 2) test if "subtitle" was in the match