文字列の置換
“aaaa1234bbbb” => “aaaabbbb” # sh % echo "aaaa1234bbbb" | sed -e 's/^\([a-z]*\)\([0-9]*\)\([a-z]*\)$/\1\3/' aaaabbbb ;; elisp(文字列の走査) (let ((str "aaaa1234bbbb")) (string-match "\\([a-z]+\\)\\([0-9]+\\)\\([a-z]+\\)" str) (concat (match-string-no-properties 1 str) (match-string-no-properties 3 str))) => "aaaabbbb" ;; elisp(バッファの走査) <= ちょっと大げさ (with-temp-buffer (let ((str "aaaa1234bbbb")) (insert str) (goto-char (point-min)) (if (re-search-forward "\\([a-z]+\\)\\([0-9]+\\)\\([a-z]+\\)" (point-max) t) (concat (match-string-no-properties 1) (match-string-no-properties 3))))) => "aaaabbbb"