Subject: bug#21995: closed (Re: bug#21995: Documentation omission for regular expressions)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 23 Nov 2015 17:03:02 +0000

Your bug report

#21995: Documentation omission for regular expressions

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
21995: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21995
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#21995: Documentation omission for regular expressions
From: Eli Zaretskii <[email-masked]>
To: jan <[email-masked]>
Cc: [email-masked]
Date: Mon, 23 Nov 2015 19:02:21 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Mon, 23 Nov 2015 12:16:59 +0000
> From: jan <[email-masked]>
> 
> \& 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,

Subject: Documentation omission for regular expressions
From: jan <[email-masked]>
To: [email-masked]
Date: Mon, 23 Nov 2015 12:16:59 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

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)