regex replace all special characters

C#
Regex.Replace(your String, @"[^0-9a-zA-Z]+", "") 
Source

Also in C#: