Variable: rfc2047-encoded-word-regexp

rfc2047-encoded-word-regexp is a variable defined in rfc2047.el.gz.

Value

"=\\?\\([^][�- ()<>@,;:*\\\"/?.=]+\\)\\(?:\\*[^?]+\\)?\\?\\(B\\?[+/0-9A-Za-z]*=*\\|Q\\?[ ->@-~]*\\)\\?="

Documentation

Regexp that matches encoded word.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/rfc2047.el.gz
(eval-and-compile ;; Necessary to hard code them in `rfc2047-decode-region'.
  (defconst rfc2047-encoded-word-regexp
    "=\\?\\([^][\000-\040()<>@,;:*\\\"/?.=]+\\)\\(?:\\*[^?]+\\)?\\?\
\\(B\\?[+/0-9A-Za-z]*=*\
\\|Q\\?[ ->@-~]*\
\\)\\?="
    "Regexp that matches encoded word."
    ;; The patterns for the B encoding and the Q encoding, i.e. the ones
    ;; beginning with "B" and "Q" respectively, are restricted into only
    ;; the characters that those encodings may generally use.
    )
  (defconst rfc2047-encoded-word-regexp-loose
    "=\\?\\([^][\000-\040()<>@,;:*\\\"/?.=]+\\)\\(?:\\*[^?]+\\)?\\?\
\\(B\\?[+/0-9A-Za-z]*=*\
\\|Q\\?\\(?:\\?+[ -<>@-~]\\)?\\(?:[ ->@-~]+\\?+[ -<>@-~]\\)*[ ->@-~]*\\?*\
\\)\\?="
    "Regexp that matches encoded word allowing loose Q encoding."
    ;; The pattern for the Q encoding, i.e. the one beginning with "Q",
    ;; is similar to:
    ;; "Q\\?\\(\\?+[^\n=?]\\)?\\([^\n?]+\\?+[^\n=?]\\)*[^\n?]*\\?*"
    ;;      <--------1-------><----------2,3----------><--4--><-5->
    ;; They mean:
    ;; 1. After "Q?", allow "?"s that follow a character other than "=".
    ;; 2. Allow "=" after "Q?"; it isn't regarded as the terminator.
    ;; 3. In the middle of an encoded word, allow "?"s that follow a
    ;;    character other than "=".
    ;; 4. Allow any characters other than "?" in the middle of an
    ;;    encoded word.
    ;; 5. At the end, allow "?"s.
    ))