【问题标题】:Emacs: Find text starting with a word and finishin with another word on the same lineEmacs:查找以单词开头的文本并在同一行上以另一个单词结尾
【发布时间】:2014-10-13 12:23:14
【问题描述】:

我想要一个命令在同一行上查找从foobar 的文本。例如:

hello foo some text here bar
goodbye foo some other text here bar

对于每一行,我想找到以foo 开头并以bar 结尾的文本。

在 Vim 中类似于 /foo.*bar

【问题讨论】:

    标签: regex search emacs


    【解决方案1】:

    您可以通过键入 C-M-sfoo.*bar

    来创建 isearch-forward-regexp

    更多帮助请见emacs documentation

    【讨论】:

      【解决方案2】:

      将光标放在foo 上,键入C-s 以启动i-search-forward,然后按C-w 4 次以扩展搜索词以覆盖接下来的4 个单词,或者点击 M-s C-e 以在搜索词中包含该行的其余部分。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-06-29
        • 2018-08-23
        • 2012-03-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多