fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6.  
  7. public class Test
  8. {
  9. public static void Main()
  10. {
  11. var str = "/*\n** 2 > 1\n** 1 < 2 \n** <file:\\\\\\server\\dir one\\dirtwo\\file name.txt>\n** <just because>\n** 1 < 2\n** 2 > 1\n** <file:\\\\\\server\\dir one\\dirtwo\\file name.txt>\n** 2 > 1\n*/";
  12. var res = Regex.Replace(str, @"<file:\\{3}[^>]+>", m => m.Value.Replace(" ", "%20"));
  13. Console.WriteLine(res);
  14. }
  15. }
Success #stdin #stdout 0.1s 24728KB
stdin
Standard input is empty
stdout
/*
**  2 > 1
**  1 < 2 
**  <file:\\\server\dir%20one\dirtwo\file%20name.txt>
**  <just because>
**  1 < 2
**  2 > 1
**  <file:\\\server\dir%20one\dirtwo\file%20name.txt>
**  2 > 1
*/