【问题标题】:How to apply replace-regexp to only a single line in emacs?如何将replace-regexp仅应用于emacs中的一行?
【发布时间】:2015-07-28 14:44:27
【问题描述】:

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

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

【问题讨论】:

    标签: regex emacs


    【解决方案1】:

    <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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多