Kai, I remember you from another emacs list about 10 years ago. Just like then, you are very helpful.
I think I may use flush-lines, which some other respondents also mentioned off-list. Someone else mentioned the "occur" function, which I haven't tried yet but apparently allows clicking on the found lines, which have been gathered into a new buffer, to jump to the context in the original buffer. The regexp problem was driving me mad, though, and I think I understand it a little better now. Thanks, Tim -- The shadow of the bamboo sweeps the steps, but the dust does not stir. > -----Original Message----- > From: news [mailto:[EMAIL PROTECTED] On Behalf Of Kai Grossjohann > Sent: Tuesday, January 27, 2004 3:33 AM > To: [EMAIL PROTECTED] > Subject: Re: O.T. Regexp question > > > "Tim Werner" <[EMAIL PROTECTED]> writes: > > > I want to open the log file with emacs, and do a > > "search-forward-regexp" to look for lines that do NOT end > with "same > > date". It turns out that I am too stoopid to figure out how to > > construct the correct regexp. > > IMHO it is better to use another Emacs feature to do what you > need. For example, you could delete all lines that end with > "same date", using the flush-lines command. Then all > remaining lines are the ones you're looking for. Or, you > write a function that looks if the current line ends with > "same date". If not, then stop, else go one line forward and repeat. > > If it MUST be a regexp, then the idea behind it is this: a > line that does not end with "same date" is a line that does > not end with "e", or a line that ends with "e" but the > character before that is not "t", or a line that ends with > "te" but the character before that is not "a", and so on. > > Here is a beginning to express this kind of logic: > > [^e]$\\|[^t]e$\\|[^a]te$\\|... > > You may have to add some rules for lines that are too short. > The above logic would not find the line "ame date", for > example, because it expects a character before the "ame > date". Of course, > > ^$\\|^.$\\|^..$ > > will match lines of up to two characters, but no longer lines. > > Kai >
