jerbersoft
jerbersoft

Reputation: 4450

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

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

Upvotes: 5

Views: 3748

Answers (2)

splattne
splattne

Reputation: 104040

<asp:RegularExpressionValidator ID="MyTextBoxValidator" runat="server" 
   ControlToValidate="MyTextBox"
   ErrorMessage="Minimum length is 6"
   ValidationExpression=".{6}.*" />

Upvotes: 4

Welbog
Welbog

Reputation: 60418

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

EDIT: I guess it worked.

Upvotes: 5

Related Questions