using System;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
var pattern = "hello % world _";
var escapedPattern = Regex.Replace(pattern, "[%_]", "_$0");
Console.WriteLine(escapedPattern);
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uVGV4dC5SZWd1bGFyRXhwcmVzc2lvbnM7CgpwdWJsaWMgY2xhc3MgVGVzdAp7CglwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpCgl7CnZhciBwYXR0ZXJuID0gImhlbGxvICUgd29ybGQgXyI7CnZhciBlc2NhcGVkUGF0dGVybiA9IFJlZ2V4LlJlcGxhY2UocGF0dGVybiwgIlslX10iLCAiXyQwIik7CkNvbnNvbGUuV3JpdGVMaW5lKGVzY2FwZWRQYXR0ZXJuKTsKCX0KfQ==