Validate at least 6 character with characters,numbers,1 upper case letter and special characters 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 with characters,numbers,1 upper case letter and
special characters."
ValidationExpression="(?=^.{6,10}$)(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+}{":;'?/>.<,])(?!.*\s).*$"
ControlToValidate="txtpwd" ForeColor="Red" Style="font-size: small"
Display="Dynamic"></asp:RegularExpressionValidator>
</div>
</form>
</body>
</html>
Out-Put:-
Validate at least 6 character with characters,numbers,1 upper case letter and special characters password using RegularExpressionValidator in asp.net C#
Reviewed by NEERAJ SRIVASTAVA
on
9:53:00 AM
Rating:
No comments: