Function: dired-mark-files-regexp

dired-mark-files-regexp is an interactive and byte-compiled function defined in dired.el.gz.

Signature

(dired-mark-files-regexp REGEXP &optional MARKER-CHAR)

Documentation

Mark all files matching REGEXP for use in later commands.

A prefix argument means to unmark them instead.
. and .. are never marked.

If the region is active in Transient Mark mode, mark files only in the active region if dired-mark-region is non-nil.

REGEXP is an Emacs regexp, not a shell wildcard. Thus, use \.o$ for object files--just .o will mark more than you might think.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired.el.gz
(defun dired-mark-files-regexp (regexp &optional marker-char)
  "Mark all files matching REGEXP for use in later commands.
A prefix argument means to unmark them instead.
`.' and `..' are never marked.

If the region is active in Transient Mark mode, mark files
only in the active region if `dired-mark-region' is non-nil.

REGEXP is an Emacs regexp, not a shell wildcard.  Thus, use `\\.o$' for
object files--just `.o' will mark more than you might think."
  (interactive
   (list (read-regexp (concat (if current-prefix-arg "Unmark" "Mark")
                              " files (regexp): ")
                      ;; Add more suggestions into the default list
                      (cons nil (list (dired-get-filename t t)
                                      (and (dired-get-filename nil t)
                                           (concat (regexp-quote
                                                    (file-name-extension
                                                     (dired-get-filename nil t) t))
                                                   "\\'"))))
                      'dired-regexp-history)
	 (if current-prefix-arg ?\s)))
  (let ((dired-marker-char (or marker-char dired-marker-char)))
    (dired-mark-if
     (and (not (looking-at-p dired-re-dot))
	  (not (eolp))			; empty line
	  (let ((fn (dired-get-filename t t)))
	    (and fn (string-match-p regexp fn))))
     "matching file")))