【问题标题】:Visual Studio: replacing { and new lineVisual Studio:替换 { 和新行
【发布时间】:2014-10-26 13:30:33
【问题描述】:

我发现我可以在“查找和替换框”正则表达式中编写以便在 Visual Studio 的代码中查找新行,但我想要做的是“对于每个 '{' 后跟一个新的行,用下一个语法符号替换它”。换句话说:

class Parser5 : Parser
{
    public Parser5(Scanner scanner) : base(scanner)
    { }
    public override Loop ParseLoop()
    {
        if(//some stuff)
        {
               return this.ParseNestedLoop();
        }
    }
}

与:

class Parser5 : Parser
{   public Parser5(Scanner scanner) : base(scanner)
    { }
    public override Loop ParseLoop()
    {   if(//some stuff)
        {return this.ParseNestedLoop();
        }
    }
}

【问题讨论】:

    标签: regex visual-studio replace visual-studio-2013 find


    【解决方案1】:
     \{\n(?<=\{\n)(.*$)
    

    你可以用这个。

    查看演示。

    http://regex101.com/r/sA7pZ0/31

    【讨论】:

    • 是啊,听起来不错,但是为什么新的文字移到了右边呢?有什么方法可以将它向左移动更多(在与以前相同的垂直位置)?
    • \{\n(?
    猜你喜欢
    • 1970-01-01
    • 2015-08-06
    • 2011-12-12
    • 2010-10-23
    • 1970-01-01
    • 2017-05-09
    • 1970-01-01
    • 1970-01-01
    • 2022-01-22
    相关资源
    最近更新 更多