unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: regexp to collapse multiple blank lines into one
Date: Mon, 10 Oct 2005 12:33:50 -0600	[thread overview]
Message-ID: <diec6g$hul$1@sea.gmane.org> (raw)
In-Reply-To: <20051010172845.GX29712@SDF.LONESTAR.ORG>

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	other threads:[~2005-10-10 18:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-09 12:27 repexp to collapse multiple blank lines into one B. T. Raven
2005-10-09 12:59 ` Friedrich Laher
2005-10-09 13:01 ` Peter Dyballa
2005-10-09 13:44 ` Neon Absentius
     [not found] ` <mailman.10556.1128865819.20277.help-gnu-emacs@gnu.org>
2005-10-09 18:36   ` regexp " B. T. Raven
2005-10-10 16:35     ` Kevin Rodgers
2005-10-10 17:28       ` Neon Absentius
2005-10-10 18:33         ` Kevin Rodgers [this message]
2005-10-10 19:06           ` Neon Absentius
     [not found]           ` <mailman.10719.1128971211.20277.help-gnu-emacs@gnu.org>
2005-10-11 22:21             ` Tim X
2005-10-12  1:14               ` Neon Absentius
2005-10-10 18:02       ` Peter Dyballa
2005-10-10 20:59 ` repexp " David Hansen
2005-10-11  2:09   ` Neon Absentius

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='diec6g$hul$1@sea.gmane.org' \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).