regex replace non alphanumeric code example
Example 1: python regex replace all non alphanumeric characters
import re
s = re.sub('[^0-9a-zA-Z]+', '*', s)
Example 2: c# filter non alphanumeric characters
Regex rgx = new Regex("[^a-zA-Z0-9 -]");
str = rgx.Replace(str, "");
Example 3: remove all non alphabetic characters from string c#
var cleanString = new string(dirtyString.Where(Char.IsLetter).ToArray());