Function: re-builder

re-builder is an autoloaded, interactive and byte-compiled function defined in re-builder.el.gz.

Signature

(re-builder)

Documentation

Construct a regexp interactively.

This command makes the current buffer the "target" buffer of the regexp builder. It displays a buffer named "*RE-Builder*" in another window, initially containing an empty regexp.

As you edit the regexp in the "*RE-Builder*" buffer, the matching parts of the target buffer will be highlighted.

Case-sensitivity can be toggled with M-x reb-toggle-case (reb-toggle-case). The regexp builder supports three different forms of input which can be set with M-x reb-change-syntax (reb-change-syntax). More options and details are provided in the Commentary section of this library.

View in manual

Probably introduced at or before Emacs version 21.1.

Key Bindings

Aliases

regexp-builder

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/re-builder.el.gz
;;;###autoload
(defun re-builder ()
  "Construct a regexp interactively.
This command makes the current buffer the \"target\" buffer of
the regexp builder.  It displays a buffer named \"*RE-Builder*\"
in another window, initially containing an empty regexp.

As you edit the regexp in the \"*RE-Builder*\" buffer, the
matching parts of the target buffer will be highlighted.

Case-sensitivity can be toggled with \\[reb-toggle-case].  The
regexp builder supports three different forms of input which can
be set with \\[reb-change-syntax].  More options and details are
provided in the Commentary section of this library."
  (interactive)
  (if (and (string= (buffer-name) reb-buffer)
	   (reb-mode-buffer-p))
      (message "Already in the RE Builder")
    (when reb-target-buffer
      (reb-delete-overlays))
    (setq reb-target-buffer (current-buffer)
          reb-target-window (selected-window))
    (select-window
     (or (get-buffer-window reb-buffer)
         (let ((dir (if (window-parameter nil 'window-side)
                        'bottom 'down)))
           (setq reb-window-config (current-window-configuration))
           (display-buffer
            (get-buffer-create reb-buffer)
            `((display-buffer-in-direction)
              (direction . ,dir)
              (dedicated . t)
              (window-height . fit-window-to-buffer))))))
    (font-lock-mode 1)
    (reb-initialize-buffer)))