I 开发者_运维问答need regex for Regular Expression Validator in ASP.NET, that user need to write in message at least 50 symbols(characters). How to do it? I tried
.(dot){50,} but it doesn't work.
.{50,}
seems a correct RegExp to me.
However, I think, the regular expression is only checked if the field is not empty, and empty strings are considered valid, so you need to couple this with a RequiredFieldValidator
.
This one should work.
<asp:RegularExpressionValidator ID="Validator1" runat="server"
ControlToValidate="TextBox"
ErrorMessage="Minimum length is 50"
ValidationExpression=".{50}.*" />
This works for me
/^[a-zA-Z0-9]{50,}$/
精彩评论