Click here to Skip to main content
15,894,002 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I need to validate the password using ASP Regular Expression Validator, whether the password has min of 8 characters with one Upper case, one numeric and one spl char.In internet there are lots of expressions are available, but none is working.
Any help would be highly appreciated.
Posted

I always use the RegExLib website, they have a lot of regular expressions. A search query for password[^] will do.

You can choose between many different kinds.
 
Share this answer
 
I think this Regular Expression would solve your problem,
<br />
^(?=.{8,})(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$


Try with this regular expression and let me know the result.
 
Share this answer
 
v2
chk d below sample for validating number

4 digit number:<br />
<asp:TextBox runat="server" id="txtNumber" />
<asp:RegularExpressionValidator runat="server" id="rexNumber" controltovalidate="txtNumber" validationexpression="^[0-9]{4}$" errormessage="Please enter a 4 digit number!" />
<br /><br />
 
Share this answer
 
You have to learn about Regular expressions. Check these, you could build yourself new expressions.
Expresso - A Tool for Building and Testing Regular Expressions[^]
Expresso - The 30 Minute Regex Tutorial[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900