Function: evil-ex-regex-case

evil-ex-regex-case is a byte-compiled function defined in evil-search.el.

Signature

(evil-ex-regex-case RE DEFAULT-CASE)

Documentation

Return the case as implied by \c or \C in regular expression RE.

If \c appears anywhere in the pattern, the pattern is case insensitive. If \C appears, the pattern is case sensitive. Only the first occurrence of \c or \C is used, all others are ignored. If neither \c nor \C appears in the pattern, the case specified by DEFAULT-CASE is used. DEFAULT-CASE should be either sensitive, insensitive or smart. In the latter case, the pattern will be case-sensitive if and only if it contains an upper-case letter, otherwise it will be case-insensitive.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-search.el
(defun evil-ex-regex-case (re default-case)
  "Return the case as implied by \\c or \\C in regular expression RE.
If \\c appears anywhere in the pattern, the pattern is case
insensitive. If \\C appears, the pattern is case sensitive.
Only the first occurrence of \\c or \\C is used, all others are
ignored. If neither \\c nor \\C appears in the pattern, the case
specified by DEFAULT-CASE is used. DEFAULT-CASE should be either
`sensitive', `insensitive' or `smart'. In the latter case, the pattern
will be case-sensitive if and only if it contains an upper-case
letter, otherwise it will be case-insensitive."
  (cond
   ((string-match "\\(?:^\\|[^\\\\]\\)\\(?:\\\\\\\\\\)*\\\\\\([cC]\\)" re)
    (if (eq (aref (match-string 1 re) 0) ?c) 'insensitive 'sensitive))
   ((eq default-case 'smart)
    (if (isearch-no-upper-case-p re t) 'insensitive 'sensitive))
   (t default-case)))