如何将replace-regexp仅应用于emacs中的一行?

时间:2015-07-28 14:44:27

标签: regex emacs

如何将replace-regexp仅应用于emacs中文本缓冲区中的单行?例如,我在org-mode中工作,并希望将此正则表达式替换仅应用于当前选定的行,而不是整个org-mode文本缓冲区:

M-x replace-regexp RET [-]\\{1\\}[ ]\\{1\\} RET RET 

1 个答案:

答案 0 :(得分:0)

<f1> f replace-regexp RET

replace-regexp is an interactive compiled Lisp function in
`replace.el'.

(replace-regexp REGEXP TO-STRING &optional DELIMITED START END
BACKWARD)

...

In Transient Mark mode, if the mark is active, operate on the contents
of the region.  Otherwise, operate from point to the end of the buffer.

换句话说,突出显示该行,然后拨打replace-regexp