Regex pattern failing

Posted by Scott Chamberlain on Stack Overflow See other posts from Stack Overflow or by Scott Chamberlain
Published on 2010-06-11T16:41:52Z Indexed on 2010/06/11 16:42 UTC
Read the original article Hit count: 511

Filed under:
|

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 ,?

© Stack Overflow or respective owner

Related posts about c#

Related posts about regex