Method: (MAKE-ANCHOR-NAME STRING)

Source

(defmethod make-anchor-name ((text string))
  (regex-replace-all "[^A-Za-z.-]" text
                     (lambda (target-string start end match-start match-end reg-starts reg-ends)
                       (declare (ignore start end match-end reg-starts reg-ends))
                       (format nil "_~4,'0X" (char-code (aref target-string match-start))))))
Source Context