Function: evil-ex-make-pattern

evil-ex-make-pattern is a byte-compiled function defined in evil-search.el.

Signature

(evil-ex-make-pattern REGEXP CASE WHOLE-LINE)

Documentation

Create a new search pattern.

REGEXP is the regular expression to be searched for. CASE should be either sensitive, insensitive for case-sensitive and case-insensitive search respectively, or smart. In the latter case the pattern is smart-case, i.e. it is automatically sensitive of the pattern contains an upper case letter, otherwise it is insensitive. The input REGEXP is considered a Vim-style regular expression if evil-ex-search-vim-style-regexp is non-nil, in which case it is transformed to an Emacs style regular expression (i.e. certain backslash-codes are transformed. Otherwise REGEXP must be an Emacs style regular expression and is not transformed.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-search.el
(defun evil-ex-make-pattern (regexp case whole-line)
  "Create a new search pattern.
REGEXP is the regular expression to be searched for. CASE should
be either `sensitive', `insensitive' for case-sensitive and
case-insensitive search respectively, or `smart'.  In the latter case
the pattern is smart-case, i.e. it is automatically sensitive of the
pattern contains an upper case letter, otherwise it is insensitive.
The input REGEXP is considered a Vim-style regular expression if
`evil-ex-search-vim-style-regexp' is non-nil, in which case it is
transformed to an Emacs style regular expression (i.e. certain
backslash-codes are transformed.  Otherwise REGEXP must be an Emacs
style regular expression and is not transformed."
  (let ((re (evil-ex-regex-without-case regexp))
        (ignore-case (eq (evil-ex-regex-case regexp case) 'insensitive)))
    ;; possibly transform regular expression from vim-style to
    ;; Emacs-style.
    (if (and evil-ex-search-vim-style-regexp
             (not (or (string-prefix-p "\\_<" regexp)
                      (string-suffix-p "\\_>" regexp))))
        (setq re (evil-transform-vim-style-regexp re))
      ;; Even for Emacs regular expressions we translate certain
      ;; whitespace sequences
      (setq re (evil-transform-regexp re '((?t . "\t")
                                           (?n . "\n")
                                           (?r . "\r")))))
    (list re ignore-case whole-line)))