Validate at least one numeric,one alphabet and one special character password using RegularExpressionValidator in asp.net C#
Source Code
<!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtpwd" runat="server"
Width="180px"></asp:TextBox>
<asp:RegularExpressionValidator
ID="revpwd"
runat="server"
ErrorMessage="Choose
at least 6 character,one numeric,one
alphabet and one special character."ValidationExpression="(?=^.{6,10}$)(?=.*\d)(?=.*[a-zA-Z])(?=.*[!@#$%^&*()_+}{":;'?/>.<,])(?!.*\s).*$"
ControlToValidate="txtpwd"
ForeColor="Red"
Style="font-size: small"
Display="Dynamic"></asp:RegularExpressionValidator>
</div>
</form>
</body>
</html>
Out put :-
Validate at least one numeric,one alphabet and one special character password using RegularExpressionValidator in asp.net C#
Reviewed by NEERAJ SRIVASTAVA
on
11:49:00 PM
Rating:
No comments: