Function: ert-filter-string
ert-filter-string is a byte-compiled function defined in ert-x.el.gz.
Signature
(ert-filter-string S &rest REGEXPS)
Documentation
Return a copy of S with all matches of REGEXPS removed.
Elements of REGEXPS may also be two-element lists (REGEXP SUBEXP), where SUBEXP is the number of a subexpression in REGEXP. In that case, only that subexpression will be removed rather than the entire match.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert-x.el.gz
;;; Miscellaneous utilities.
(defun ert-filter-string (s &rest regexps)
"Return a copy of S with all matches of REGEXPS removed.
Elements of REGEXPS may also be two-element lists \(REGEXP
SUBEXP), where SUBEXP is the number of a subexpression in
REGEXP. In that case, only that subexpression will be removed
rather than the entire match."
;; Use a temporary buffer since replace-match copies strings, which
;; would lead to N^2 runtime.
(with-temp-buffer
(insert s)
(dolist (x regexps)
(cl-destructuring-bind (regexp subexp) (if (listp x) x `(,x nil))
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(replace-match "" t t nil subexp))))
(buffer-string)))