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 = "A tab\there \"inside\ta\tdouble-quoted\tsubstring\" some\there";
  12. var pattern = "\"[^\"]+\""; // A pattern to match a double quoted substring with no escape sequences
  13. var result = Regex.Replace(str, pattern, m =>
  14. m.Value.Replace("\t", "-")); // Replace the tabs inside double quotes with -
  15. Console.WriteLine(result);
  16. }
  17. }
Success #stdin #stdout 0.04s 134720KB
stdin
Standard input is empty
stdout
A tab	here "inside-a-double-quoted-substring" some	here