[英]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 have spaces but I don't want users to put any special characters.
字段之一是名称,可以有空格,但是我不希望用户放置任何特殊字符。
bool isValid = Regex.IsMatch(name, "^[a-z0-9 ]+$", RegexOptions.IgnoreCase);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.