Replace single backslash with double backslash

前端 未结 5 2147
隐瞒了意图╮
隐瞒了意图╮ 2020-12-18 18:59

It seems simple enough, right? Well, I don\'t know.

Here\'s the code I\'m trying:

input = Regex.Replace(input, \"\\\\\", \"\\\\\\\\\\\\\");
         


        
5条回答
  •  醉梦人生
    2020-12-18 19:25

     var result = Regex.Replace(@"afd\tas\asfd\", @"\\", @"\\");
    

    The first parameter is string \\ which is \ in regex.
    The second parameter is not processed by regex, so it will put it as is, when replacing.

提交回复
热议问题