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: Malte Spiess
Subject: Re: RegExp: match everything except a certain string
Date: Wed, 28 Nov 2007 22:22:26 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Sven Utcke <utcke+news@informatik.uni-hamburg.de> writes:

> Sven Bretfeld <sven.bretfeld@gmx.ch> writes:
>
>> 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.)
>
> I haven't followed the original thread, so I might be way of the mark
> here, but the above would of course not find "title = {}" either (as
> well as quite a few less likely variations).

Yeah, you are right, the [^s]? (and so on) seem pretty useless because
the empty string matches them. The whole expression can be reduced to

[^e] = {},?$

which means that any string that does not end with an "e" should be
matched... (it does that here)

Greetings
Malte


reply via email to

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