2004-12 / 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
"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"
2004-12 / 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31