Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegularExpressionValidator is failing...how to cap it at 20 characters

Status
Not open for further replies.

Coder76

Programmer
Sep 4, 2001
5
US
Hi. I have a regularexpressionvalidator that should meet these requirements when a user enters a password:

-- Must be be 8-20 characters
-- Must include at least one uppper case and one lower case letter
-- Must include at least one special characters (~ ! @ # $ % ^ & *)

Here is what I have for my validationExpression:

^.*(?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[\*@~!#$%^&]).*$

The problem is that it does not cap the password at 20 characters. How can I make it do this? Thanks you in advance for your help!
 
TextBox t = new TextBox();
t.MaxLength = 20;

If [blue]you have problems[/blue], I want [green]source code[/green] AND [green]error messages[/green], none of this [red]"there was an error crap"[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top