aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-03-14 22:57:28 +0000
committerDave Love2000-03-14 22:57:28 +0000
commit1697159cc145f3c51aecc208a22d5c07fccceb96 (patch)
tree525216da3d58c4c8a0d1f388ddd5b17bbad09a43
parent9c763cca0be05366841a42a4a31f06726bc5de60 (diff)
downloademacs-1697159cc145f3c51aecc208a22d5c07fccceb96.tar.gz
emacs-1697159cc145f3c51aecc208a22d5c07fccceb96.zip
(replace-regexp-in-string): Renamed from
replace-regexps-in-string. Doc fix.
-rw-r--r--lisp/subr.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 29af26732df..9074d3bbd3e 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1196,8 +1196,8 @@ Unless optional argument INPLACE is non-nil, return a new string."
1196 (aset newstr i tochar))) 1196 (aset newstr i tochar)))
1197 newstr)) 1197 newstr))
1198 1198
1199(defun replace-regexps-in-string (regexp rep string &optional 1199(defun replace-regexp-in-string (regexp rep string &optional
1200 fixedcase literal subexp start) 1200 fixedcase literal subexp start)
1201 "Replace all matches for REGEXP with REP in STRING. 1201 "Replace all matches for REGEXP with REP in STRING.
1202 1202
1203Return a new string containing the replacements. 1203Return a new string containing the replacements.
@@ -1211,7 +1211,11 @@ function. If it is a function it is applied to each match to generate
1211the replacement passed to `replace-match'; the match-data at this 1211the replacement passed to `replace-match'; the match-data at this
1212point are such that match 0 is the function's argument. 1212point are such that match 0 is the function's argument.
1213 1213
1214To replace a single match, make REGEXP match up to \\'." 1214To replace only the first match (if any), make REGEXP match up to \\'
1215and replace a sub-expression, e.g.
1216 (replace-regexp-in-string \"\\(foo\\).*\\'\" \"bar\" \" foo foo\" nil nil 1)
1217 => \" bar foo\"
1218"
1215 1219
1216 ;; To avoid excessive consing from multiple matches in long strings, 1220 ;; To avoid excessive consing from multiple matches in long strings,
1217 ;; don't just call `replace-match' continually. Walk down the 1221 ;; don't just call `replace-match' continually. Walk down the