GNU bug report logs - #21995
Documentation omission for regular expressions

Previous Next

Package: emacs;

Reported by: jan <rtm443x <at> googlemail.com>

Date: Mon, 23 Nov 2015 16:45:06 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21995 in the body.
You can then email your comments to 21995 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#21995; Package emacs. (Mon, 23 Nov 2015 16:45:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to jan <rtm443x <at> googlemail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 23 Nov 2015 16:45:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: jan <rtm443x <at> googlemail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Documentation omission for regular expressions
Date: Mon, 23 Nov 2015 12:16:59 +0000
Hi,
\& used as a replacement will substitute in the entire matched
pattern.  For example, given text

hello

and search regexp  \(.\)  with replacement  \&\&  you get

hheelloo

I have not been able to find this \& option in the regular expression
part of the emacs manual.

jan

(Emacs 24.5.1 running on Windows 2008 R2)




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Mon, 23 Nov 2015 17:03:01 GMT) Full text and rfc822 format available.

Notification sent to jan <rtm443x <at> googlemail.com>:
bug acknowledged by developer. (Mon, 23 Nov 2015 17:03:02 GMT) Full text and rfc822 format available.

Message #10 received at 21995-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: jan <rtm443x <at> googlemail.com>
Cc: 21995-done <at> debbugs.gnu.org
Subject: Re: bug#21995: Documentation omission for regular expressions
Date: Mon, 23 Nov 2015 19:02:21 +0200
> Date: Mon, 23 Nov 2015 12:16:59 +0000
> From: jan <rtm443x <at> googlemail.com>
> 
> \& used as a replacement will substitute in the entire matched
> pattern.  For example, given text
> 
> hello
> 
> and search regexp  \(.\)  with replacement  \&\&  you get
> 
> hheelloo
> 
> I have not been able to find this \& option in the regular expression
> part of the emacs manual.

It's described in the node "Regexp Replace" (since it's only relevant
to replacing a matched regexp).  Quote:

  `M-x replace-regexp <RET> REGEXP <RET> NEWSTRING <RET>'
       Replace every match for REGEXP with NEWSTRING.

     In `replace-regexp', the NEWSTRING need not be constant: it can
  refer to all or part of what is matched by the REGEXP.  `\&' in
  NEWSTRING stands for the entire match being replaced.  `\D' in
  NEWSTRING, where D is a digit, stands for whatever matched the Dth
  parenthesized grouping in REGEXP.  (This is called a "back reference".)
  `\#' refers to the count of replacements already made in this command,
  as a decimal number.  In the first replacement, `\#' stands for `0'; in
  the second, for `1'; and so on.  For example,





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 22 Dec 2015 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 181 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.