What is the expression on RegularExpressionValidator to check if the Textbox text is 6 or more characters long?

前端 未结 2 416
夕颜
夕颜 2021-01-19 02:59

what is the format for the RegularExpressionValidator control to check if the textbox to be validated has 6 or more characters?

相关标签:
2条回答
  • 2021-01-19 03:21
    <asp:RegularExpressionValidator ID="MyTextBoxValidator" runat="server" 
       ControlToValidate="MyTextBox"
       ErrorMessage="Minimum length is 6"
       ValidationExpression=".{6}.*" />
    
    0 讨论(0)
  • 2021-01-19 03:46

    ^.{6,}$ will do it in most variants of regex. Let me verify it works in this specific case.

    EDIT: I guess it worked.

    0 讨论(0)
提交回复
热议问题