Try thisone:
public static Boolean isAlphaNumeric(string strToCheck)
{
Regex rg = new Regex(@"^[a-zA-Z0-9\s,]*$");
return rg.IsMatch(strToCheck);
}
It's more undestandable, if you specify in regex, what your string SHOULD contain, and not what it MUST NOT.
In the example above:
List item
^ - means start of the string
[]* - could contain any number of characters between brackets
a-zA-Z0-9 - any alphanumeric characters
\s - any space characters (space/tab/etc.)
, - commas
$ - end of the string
Found it: here[^]
Have a look at many similar threads
here[
^]