fork(4) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string text = "Hello world :low this \"but not this\" or 'this'";
  9. text = Regex.Replace(text, @":\w+|""[^""]*""|'[^']*'|(.)",
  10. match => match.Groups[1].Success ? match.Groups[1].Value.ToUpper() : match.Value);
  11. Console.WriteLine(text);
  12. }
  13. }
Success #stdin #stdout 0.08s 38232KB
stdin
Standard input is empty
stdout
HELLO WORLD :low THIS "but not this" OR 'this'