using System.Text.RegularExpressions;
public static void Main()
var x = new Regex(@"[^\p{L}\d]");
MatchTest(ref x, "Bananas12345");
MatchTest(ref x, @"..\../..\https://www.badsite.com/bad%20path/x?y=z#badplace");
MatchTest(ref x, "Àâãäåæçèéêëìíîïðñòóôõøùúûüýþÿı");
MatchTest(ref x, "¢¬¶À");
MatchTest(ref x, "速速上手上手で");
MatchTest(ref x, "假借字转注字轉注字");
MatchTest(ref x, "احتاجاناتدربعلىالعربية");
private static void MatchTest(ref Regex x, string test)
Console.WriteLine(test + ":OK");
Console.WriteLine(test + ":failed. Cleaned:" + x.Replace(test,""));