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}.*" />
这对我有用
/^[a-zA-Z0-9]{50,}$/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.