Function: reftex-index-make-phrase-regexp

reftex-index-make-phrase-regexp is a byte-compiled function defined in reftex-index.el.gz.

Signature

(reftex-index-make-phrase-regexp PHRASE &optional AS-WORDS ALLOW-NEWLINE)

Documentation

Return a regexp matching PHRASE, even if distributed over lines.

With optional arg AS-WORDS, require word boundary at beginning and end. With optional arg ALLOW-NEWLINE, allow single newline between words.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex-index.el.gz
(defun reftex-index-make-phrase-regexp (phrase &optional
                                               as-words allow-newline)
  "Return a regexp matching PHRASE, even if distributed over lines.
With optional arg AS-WORDS, require word boundary at beginning and end.
With optional arg ALLOW-NEWLINE, allow single newline between words."
  (let* ((words (split-string phrase))
         (space-re (if allow-newline
                       "\\([ \t]*\\(\n[ \t]*\\)?\\|[ \t]\\)"
                     "\\([ \t]+\\)")))
    (concat (if (and as-words (string-match "\\`\\w" (car words)))
                "\\(\\<\\|[`']\\)" "")
            (mapconcat (lambda (w) (regexp-quote
                                    (if reftex-index-phrases-case-fold-search
                                        (downcase w)
                                      w)))
                       words space-re)
            (if (and as-words
                     (string-match "\\w\\'" (nth (1- (length words)) words)))
                "\\(\\>\\|'\\)" ""))))