summaryrefslogtreecommitdiff
path: root/lispref
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-08-08 20:08:09 +0000
committerRichard M. Stallman <rms@gnu.org>1995-08-08 20:08:09 +0000
commit918f3d88657bb19f68c5f945bf2b5307473236c5 (patch)
tree2b03a38b1ba0a98860c3bdc7383024967c21eb86 /lispref
parent9a5f4d1ca96ae6fe3ef86c0e316e712d1a458ccb (diff)
downloademacs-918f3d88657bb19f68c5f945bf2b5307473236c5.tar.gz
Add subexp arg to replace-match.
Diffstat (limited to 'lispref')
-rw-r--r--lispref/searching.texi8
1 files changed, 7 insertions, 1 deletions
diff --git a/lispref/searching.texi b/lispref/searching.texi
index 073c1ae212a..9c8c37e08d3 100644
--- a/lispref/searching.texi
+++ b/lispref/searching.texi
@@ -1079,7 +1079,7 @@ character of the buffer counts as 1.)
@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 @@ Subexpressions are those expressions grouped inside @samp{\(@dots{}\)}.
@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