【问题标题】:Replace single dash between numerals with double-dash用双破折号替换数字之间的单破折号
【发布时间】:2011-08-28 08:12:33
【问题描述】:

我无法确定在 emacs 中使用正则表达式进行替换搜索的语法。我想要做的是用双破折号-- 替换出现在数字[0-9] 之间的所有单破折号-。

【问题讨论】:

    标签: regex emacs


    【解决方案1】:

    这对我有用 M-x replace-regexp

    Replace-regexp: \([0-9]+\)-\([0-9]+\) with: \1--\2
    

    这替换:

    12-345
    0-1
    

    与:

    12--345
    0--1
    

    【讨论】:

      【解决方案2】:

      尝试替换模式:

      \([0-9]\)-\([0-9]\)
      

      与:

      \1--\2
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-06-06
        • 1970-01-01
        • 2013-10-09
        • 2011-03-08
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多