[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RegExp: match everything except a certain string
From: |
Andreas Röhler |
Subject: |
Re: RegExp: match everything except a certain string |
Date: |
Tue, 20 Nov 2007 18:50:02 +0100 |
User-agent: |
KMail/1.9.5 |
Am Dienstag, 20. November 2007 17:08 schrieb Sven Bretfeld:
> Hello to all
>
> A RegExp beginner's question again. I cannot find a way to search for
> a regexp that matches everything except of one certain string. The
> problem is:
>
> 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:
>
> ^ \<[^s].* = {},*
>
> But this one also excludes the "series line", of course. I was
> thinking of \<[^s][^u] but this doesn't work, since, then, the initial
> s of "subtitle" is matched again.
>
> What is the syntax for find .* except of the string "subtitle"? I
> didn't recognize this in the Lisp info.
>
> Thanks for help
>
> Sven
Got it with:
[^s]?[^u]?[^b]?[^t]?[^i]?[^t]?[^l]?[^e] = {},?$
Please don't ask why :)
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.
Andreas Röhler
Message not available