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

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

Re: regexp to collapse multiple blank lines into one


From: Kevin Rodgers
Subject: Re: regexp to collapse multiple blank lines into one
Date: Mon, 10 Oct 2005 12:33:50 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Neon Absentius wrote:
> Actually that also works.  The reason I used "\1" is that I had
> already grouped the regexp so it saved me typing.
...
> I don't understand what you don't understand :) My solutions replaces
> one or more occurences of a regexp with a single occurence.  Perhaps
> you are worried abour efficiency?

No, it was just that I read \(...\)+ as \(...+\).

\(...\)+ is suspect to me, since in the general case ... can match
different literal strings in the buffer and it wasn't obvious to me what
\1 should refer to.  I know see that the Emacs manual says

     If a particular `\( ... \)' construct matches more than once
     (which can easily happen if it is followed by `*'), only the last
     match is recorded.

but I guess I was effected by my experience with a proprietary text
processing language (which shall remain nameless) that prohibited such
references.

In any case, replacing \(^ C-q C-j \)+ with \1 is 10 key strokes, which
is actually more typing than if you were to replace ^ C-q C-j + with C-q
C-j (6 keys).

--
Kevin Rodgers





reply via email to

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