Function: projectile-replace--toggle-regexp
projectile-replace--toggle-regexp is an interactive and byte-compiled
function defined in projectile.el.
Signature
(projectile-replace--toggle-regexp)
Documentation
Toggle between literal and regexp search, re-scan, and re-render.
Switching to regexp mode with a term that is not a valid regexp is refused with a message so the buffer stays usable rather than erroring.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-replace--toggle-regexp ()
"Toggle between literal and regexp search, re-scan, and re-render.
Switching to regexp mode with a term that is not a valid regexp is
refused with a message so the buffer stays usable rather than erroring."
(interactive)
(let ((new-literal (not projectile-replace--literal)))
(if (and (not new-literal)
(not (projectile-replace--valid-regexp-p projectile-replace--term)))
(message "%s"
(projectile-prepend-project-name
(format "%S is not a valid regexp; staying literal"
projectile-replace--term)))
(setq projectile-replace--literal new-literal
projectile-replace--search (if new-literal
(regexp-quote projectile-replace--term)
projectile-replace--term)
;; the ripgrep equivalent (if any) described the old search
projectile-replace--rg-pattern nil)
(projectile-replace--regather)
(message "%s"
(projectile-prepend-project-name
(if new-literal "literal search" "regexp search"))))))