using System;
using System.Text .RegularExpressions ;
public class Test
{
public static void Main( )
{
string s = "## I am `testing` ~~something~~ _that_ *is* [a](https://google.com)" ;
string pattern = "([*_~#`]|http)" ;
string replacement = "\\ $1" ;
Regex rgx = new Regex( pattern) ;
string t = rgx.Replace ( s, replacement) ;
Console.WriteLine ( "Original String: {0}" , s) ;
Console.WriteLine ( "Replacement String: {0}" , t) ;
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uVGV4dC5SZWd1bGFyRXhwcmVzc2lvbnM7CgpwdWJsaWMgY2xhc3MgVGVzdAp7CglwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpCgl7CiAgICAgIHN0cmluZyBzID0gIiMjIEkgYW0gYHRlc3RpbmdgIH5+c29tZXRoaW5nfn4gX3RoYXRfICppcyogW2FdKGh0dHBzOi8vZ29vZ2xlLmNvbSkiOwogICAgICBzdHJpbmcgcGF0dGVybiA9ICIoWypffiNgXXxodHRwKSI7CiAgICAgIHN0cmluZyByZXBsYWNlbWVudCA9ICJcXCQxIjsKICAgICAgCiAgICAgIFJlZ2V4IHJneCA9IG5ldyBSZWdleChwYXR0ZXJuKTsKICAgICAgc3RyaW5nIHQgPSByZ3guUmVwbGFjZShzLCByZXBsYWNlbWVudCk7CgogICAgICBDb25zb2xlLldyaXRlTGluZSgiT3JpZ2luYWwgU3RyaW5nOiB7MH0iLCBzKTsKICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlJlcGxhY2VtZW50IFN0cmluZzogezB9IiwgdCk7ICAKCX0KfQ==