all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#21995: Documentation omission for regular expressions
@ 2015-11-23 12:16 jan
  2015-11-23 17:02 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: jan @ 2015-11-23 12:16 UTC (permalink / raw)
  To: 21995

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)





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#21995: Documentation omission for regular expressions
  2015-11-23 12:16 bug#21995: Documentation omission for regular expressions jan
@ 2015-11-23 17:02 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2015-11-23 17:02 UTC (permalink / raw)
  To: jan; +Cc: 21995-done

> Date: Mon, 23 Nov 2015 12:16:59 +0000
> From: jan <rtm443x@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,






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-23 17:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-23 12:16 bug#21995: Documentation omission for regular expressions jan
2015-11-23 17:02 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.