I am trying to strip out all things that are in a string that are not a letter number or space so I created the regex
private static Regex _NonAlphaChars = new Regex("[^[A-Za-z0-9 ]]", RegexOptions.Compiled);
however When I call _NonAlphaChars.Replace("Scott,", ""); it returns "Scott,"
What am I doing wrong that it is not matching the ,?
You did something funny with the double bracketing. Change it to just
Dropping your original expression into The Regex Coach explained your regex as:
For contrast, the explanation of the alternative I wrote is: