regex - ASP.NET MVC Attribute Not Functioning on Entire String Match -
why when specify against asp.net mvc view model class following definition:
[stringlength(11)] [regularexpression(@"^(09)[1-3][0-9]\d{7}$")] public string mobile { get; set; } this format mobile in iran:
start with: 09
a digit number between 1 , 3
7 digit between 0 , 9
but when enter mobile number (for example 09124208640) modelstate isn't valid , error message :
the field mobile must match regular expression '^(09)[1-3][0-9]\\d{7}$'.
you have typo:
"^(09)[1-3][0-9]\d{7]$" ^ replace ] }.
Comments
Post a Comment