views:

541

answers:

3

Hello guys,

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

+1  A: 

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

EDIT: I guess it worked.

Welbog
i used ^\w{6,}$ and works! thanks for the idea.
jerbersoft
+1  A: 
<asp:RegularExpressionValidator ID="MyTextBoxValidator" runat="server" 
   ControlToValidate="MyTextBox"
   ErrorMessage="Minimum length is 6"
   ValidationExpression=".{6}.*" />
splattne
this works too. thanks!
jerbersoft
A: 

You can also use the RangeValidator with the properties Type set to Integer and MinimumValue Set to 6

Marwan Aouida
So, if you insert "7" in the textbox it will be validated, although it has only character?
splattne