[英]asp.net regular expression doesn't check correctly
I have a simple regularExpression which checks to see if the given information is only 4 digits long and only contains digits. 我有一个简单的regularExpression,它可以检查给定的信息是否只有4位数字长且仅包含数字。 I have something that works but it doesn't allow the user to start the first digit off as a 0, any ideas why? 我有一些有效的方法,但是它不允许用户将第一个数字从0开始,有什么想法吗? Here is my regularexpression 这是我的正则表达式
[RegularExpression("^[0-9]{4,4}$", ErrorMessage = "PIN did not follow the correct format of 4-digits")]
More information 更多信息
[Required(ErrorMessage = "Please input your 4 digit pin.")] [RegularExpression("^[0-9]{4,4}$", ErrorMessage = "PIN did not follow the correct format of 4-digits")] [Display(Name = "PIN")] public long PIN { get; [Required(ErrorMessage =“请输入您的4位数密码。”)] [RegularExpression(“ ^ [0-9] {4,4} $”,ErrorMessage =“ PIN格式不正确,为4位数”) ] [Display(Name =“ PIN”)]公共长PIN {get; set; 组; } }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.