changeset 12805:6bf9976041ca

Add subexp arg to replace-match.
author Richard M. Stallman <rms@gnu.org>
date Tue, 08 Aug 1995 20:08:09 +0000
parents 1619fcabdb99
children 826ee893ebdf
files lispref/searching.texi
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lispref/searching.texi	Tue Aug 08 08:12:07 1995 +0000
+++ b/lispref/searching.texi	Tue Aug 08 20:08:09 1995 +0000
@@ -1079,7 +1079,7 @@
 @var{replacement}.
 
 @cindex case in replacements
-@defun replace-match replacement &optional fixedcase literal string
+@defun replace-match replacement &optional fixedcase literal string subexp
 This function replaces the text in the buffer (or in @var{string}) that
 was matched by the last search.  It replaces that text with
 @var{replacement}.
@@ -1127,6 +1127,12 @@
 @cindex @samp{\} in replacement
 @samp{\\} stands for a single @samp{\} in the replacement text.
 @end table
+
+If @var{subexp} is non-@code{nil}, that says to replace just
+subexpression number @var{subexp} of the regexp that was matched, not
+the entire match.  For example, after matching @samp{foo \(ba*r\)},
+calling @code{replace-match} with 1 as @var{subexp} means to replace
+just the text that matched @samp{\(ba*r\)}.
 @end defun
 
 @node Entire Match Data