;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/test.el (defun do-it (beg end) (interactive "*r") (let ((col "\\([[:alnum:]]+\\)")) (goto-char beg) (while (re-search-forward (format "^%s %s %s %s %s %s$" col col col col col col) end t) (replace-match "\\4 \\2 \\3 \\1 \\5 \\6") ))) (provide 'test)