fork(5) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var pattern = "hello % world _";
  9. var escapedPattern = Regex.Replace(pattern, "[%_]", "_$0");
  10. Console.WriteLine(escapedPattern);
  11. }
  12. }
Success #stdin #stdout 0.07s 34128KB
stdin
Standard input is empty
stdout
hello _% world __