今天来实现一个自定义函数,把选中的字符串中的数字都替换为*
,代码如下:
(defun replace-digit-in-region (start end)
"Replace all digits by * in a region."
(interactive
(if (use-region-p)
(list (region-beginning) (region-end))
(list nil nil)))
(if (and start end)
(query-replace-regexp "[0-9]" "*" nil start end)
(message "no region selected!")))
网友评论