- ;; eliminate all ".", "/", "\" from beginning. Always matches.
- (string-match "^[./\\]*\\(.*\\)$" dirnam)
- (setq group (substitute ?. ?/ (match-string 1 dirnam))) ;; "/" -> "."
- (setq group (substitute ?. ?\\ group)) ;; "\\" -> "."
+ ;; Set group to dirnam without any leading dots or slashes,
+ ;; and with all subsequent slashes replaced by dots
+ (setq group (gnus-replace-in-string
+ (gnus-replace-in-string dirnam "^[./\\]" "" t)
+ "[/\\]" "." t))