regex remove all non alphanumeric code example
Example 1: remove non alphanumeric characters javascript
input.replace(/\W/g, '') //doesnt include underscores
input.replace(/[^0-9a-z]/gi, '') //removes underscores too
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());
Example 4: regex remove all non alphanumeric except spaces
/[^[:alnum:]\x20/gi