Today i had to use a minimum and maximum TextBox length RegEx,
so here it is, simple and handy, in my context i had a password field which we require the user to have at least 8 characters and the user can only have as many as 34 characters.
on your aspx page place the following RegEx where you want it to show the Error,
as you notice in the asp:RegularExpressionValidator control above, the attribute, ValidationExpression is equal to [\S\s]{8,34} , in the context of this example it is important to notice that enforced number of minimum characters and 34 is the number of maximum allowed characters.
The ToxtBox which the RegEx is hooked up to,
Please let me know, in case of more explanation needed
No comments:
Post a Comment