Function: cua-replace-in-rectangle

cua-replace-in-rectangle is an interactive and byte-compiled function defined in cua-rect.el.gz.

Signature

(cua-replace-in-rectangle REGEXP NEWTEXT)

Documentation

Replace REGEXP with NEWTEXT in each line of CUA rectangle.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emulation/cua-rect.el.gz
(defun cua-replace-in-rectangle (regexp newtext)
  "Replace REGEXP with NEWTEXT in each line of CUA rectangle."
  (interactive "sReplace regexp: \nsNew text: ")
  (if buffer-read-only
      (message "Cannot replace in read-only buffer")
    (cua--rectangle-operation 'keep nil t 1 nil
     (lambda (_s e _l _r)
        (if (re-search-forward regexp e t)
            (replace-match newtext nil nil))))))