Regular Expression for ideal Password

We usually have to validated the password being submitted by the user during the registration.

Its is very much essential to provide the regular expression validtor here.
In my case i had this urgent requirement to do so.

In my case the password entered by the user had to be at least 6 characters long and max 10 characters long.

Moreover i also had this requirement of including at least one Upper case ,lower case and one numeric digit.


Hence , i came up with the following reular expression that suited all my cases :-


^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,10}$


<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<br />
<asp:TextBox ID="txtPassword" runat="server">
</asp:TextBox>
<br />

Tip for password : at least 6 digit long, at least one Upper Case,Lower Case and Numeric digit</div>

<p>

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtPassword"
ErrorMessage="Please Read the directions Tip above for the ideal password"
ValidationExpression="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,10}$">

</asp:RegularExpressionValidator>
</p>
</form>



I hope it helps the need ...cheers...happy codeing...:-)


Comments

Author: Manindra Kumar Upadhyay09 Apr 2010 Member Level: Gold   Points : 1

try this link:
http://www.manindra.net/post/2010/04/09/AspNet-Regular-Expressions.aspx



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: