Looking for regex to allow spaces but doesn't allow special characters?
I'm implementing validation for registration form. One of the field is name, can 开发者_JAVA百科have spaces but I don't want users to put any special characters.
bool isValid = Regex.IsMatch(name, "^[a-z0-9 ]+$", RegexOptions.IgnoreCase);
精彩评论