Function: gnus-uu-reginize-string

gnus-uu-reginize-string is a byte-compiled function defined in gnus-uu.el.gz.

Signature

(gnus-uu-reginize-string STRING)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-uu.el.gz
;; Functions for treating subjects and collecting series.

(defun gnus-uu-reginize-string (string)
  ;; Takes a string and puts a \ in front of every special character;
  ;; replaces the last thing that looks like "2/3" with "[0-9]+/3"
  ;; or, if it can't find something like that, tries "2 of 3", then
  ;; finally just replaces the next to last number with "[0-9]+".
  (with-current-buffer (gnus-get-buffer-create gnus-uu-output-buffer-name)
    (buffer-disable-undo)
    (erase-buffer)
    (insert (regexp-quote string))

    (setq case-fold-search nil)

    (end-of-line)
    (if (re-search-backward "\\([^0-9]\\)[0-9]+/\\([0-9]+\\)" nil t)
	(replace-match "\\1[0-9]+/\\2")

      (end-of-line)
      (if (re-search-backward "\\([^0-9]\\)[0-9]+[ \t]*of[ \t]*\\([0-9]+\\)"
			      nil t)
	  (replace-match "\\1[0-9]+ of \\2")

	(end-of-line)
	(if (re-search-backward "\\([^0-9]\\)[0-9]+\\([^0-9]+\\)[0-9]+"
				nil t)
	    (replace-match "\\1[0-9]+\\2[0-9]+" t nil nil nil))))

    (goto-char (point-min))
    (while (re-search-forward "[ \t]+" nil t)
      (replace-match "[ \t]+" t t))

    (buffer-string)))