summaryrefslogtreecommitdiff
path: root/man/search.texi
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2006-04-12 13:40:23 +0000
committerEli Zaretskii <eliz@gnu.org>2006-04-12 13:40:23 +0000
commit0d8b7acbb3dd5af4b7cb7174920ca510a9c4eeac (patch)
treec655d323a01bf7820060c0fa0367f571840ab21a /man/search.texi
parent483b913a7bd9ef09352c9527d3f1290fcbdee84e (diff)
downloademacs-0d8b7acbb3dd5af4b7cb7174920ca510a9c4eeac.tar.gz
(Regexp Backslash, Regexp Replace): Add index entries for ``back reference''
and mention the term itself in the text.
Diffstat (limited to 'man/search.texi')
-rw-r--r--man/search.texi12
1 files changed, 7 insertions, 5 deletions
diff --git a/man/search.texi b/man/search.texi
index a38f56e3f26..ab109445091 100644
--- a/man/search.texi
+++ b/man/search.texi
@@ -750,8 +750,9 @@ can add groups for syntactic purposes without interfering with
the numbering of the groups that are meant to be referred to.
@item \@var{d}
+@cindex back reference, in regexp
matches the same text that matched the @var{d}th occurrence of a
-@samp{\( @dots{} \)} construct.
+@samp{\( @dots{} \)} construct (a.k.a.@: @dfn{back reference}).
After the end of a @samp{\( @dots{} \)} construct, the matcher remembers
the beginning and end of the text matched by that construct. Then,
@@ -1002,15 +1003,16 @@ any match for a specified pattern.
Replace every match for @var{regexp} with @var{newstring}.
@end table
+@cindex back reference, in regexp replacement
In @code{replace-regexp}, the @var{newstring} need not be constant:
it can refer to all or part of what is matched by the @var{regexp}.
@samp{\&} in @var{newstring} stands for the entire match being
replaced. @samp{\@var{d}} in @var{newstring}, where @var{d} is a
digit, stands for whatever matched the @var{d}th parenthesized
-grouping in @var{regexp}. @samp{\#} refers to the count of
-replacements already made in this command, as a decimal number. In
-the first replacement, @samp{\#} stands for @samp{0}; in the second,
-for @samp{1}; and so on. For example,
+grouping in @var{regexp} (a.k.a.@: ``back reference''). @samp{\#}
+refers to the count of replacements already made in this command, as a
+decimal number. In the first replacement, @samp{\#} stands for
+@samp{0}; in the second, for @samp{1}; and so on. For example,
@example
M-x replace-regexp @key{RET} c[ad]+r @key{RET} \&-safe @key{RET}