help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RegExp: match everything except a certain string


From: Lennart Borgman (gmail)
Subject: Re: RegExp: match everything except a certain string
Date: Tue, 20 Nov 2007 22:05:42 +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

Sven Bretfeld wrote:
Hello Andreas

Andreas Röhler <andreas.roehler@online.de> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]