Function: dired-string-replace-match
dired-string-replace-match is a byte-compiled function defined in
dired.el.gz.
Signature
(dired-string-replace-match REGEXP STRING NEWTEXT &optional LITERAL GLOBAL)
Documentation
Replace first match of REGEXP in STRING with NEWTEXT.
If it does not match, nil is returned instead of the new string. Optional arg LITERAL means to take NEWTEXT literally. Optional arg GLOBAL means to replace all matches.
Source Code
;; Defined in /usr/src/emacs/lisp/dired.el.gz
(defun dired-string-replace-match (regexp string newtext
&optional literal global)
"Replace first match of REGEXP in STRING with NEWTEXT.
If it does not match, nil is returned instead of the new string.
Optional arg LITERAL means to take NEWTEXT literally.
Optional arg GLOBAL means to replace all matches."
(if global
(let ((start 0) ret)
(while (string-match regexp string start)
(let ((from-end (- (length string) (match-end 0))))
(setq ret (setq string (replace-match newtext t literal string)))
(setq start (- (length string) from-end))))
ret)
(if (not (string-match regexp string 0))
nil
(replace-match newtext t literal string))))