Monday, August 28
Good & tested RegularExpression for validating passwords?
Any sample tested and working Regular expression for validating the password?
I was using
RequiredFieldValidator
ID="RequiredFieldValidator1" runat="server"
ErrorMessage="Please enter password" ControlToValidate="txtPassword" Display="none">
RegularExpressionValidator
ID="regValPassword" runat="server"
ErrorMessage="Enter valid password" Display="None"
ControlToValidate="txtPassword" ValidationExpression="^\w{3,12}$">
for basic filtering
any better thoughts for allowing 8-12 char passwords with special characters too?
I found some scripts on the net but they didn't seem to work with
asp.net's RegularExpressionValidator
Thoughts welcome.
I was using
RequiredFieldValidator
ErrorMessage="Please enter password" ControlToValidate="txtPassword" Display="none">
RegularExpressionValidator
ErrorMessage="Enter valid password" Display="None"
ControlToValidate="txtPassword" ValidationExpression="^\w{3,12}$">
for basic filtering
any better thoughts for allowing 8-12 char passwords with special characters too?
I found some scripts on the net but they didn't seem to work with
asp.net's RegularExpressionValidator
Comments:
<< Home
Since . matches any character including special characters but not linefeed and carriage return, shouldn't the regex be:
^.{8,12}$
Or, if you want to exclude certain special characters, then you can use a negated character class instead of the period. For example, to exclude the greater than sign:
^[^>]{8,12}$
Is this similar to what you are looking for?
You probably already have this link, but here goes anyway: http://regexlib.com/RETester.aspx is an online regex tester that uses the .Net regex engine itself. It is a nice playground for testing out regular expressions.
^.{8,12}$
Or, if you want to exclude certain special characters, then you can use a negated character class instead of the period. For example, to exclude the greater than sign:
^[^>]{8,12}$
Is this similar to what you are looking for?
You probably already have this link, but here goes anyway: http://regexlib.com/RETester.aspx is an online regex tester that uses the .Net regex engine itself. It is a nice playground for testing out regular expressions.
thanks sougata. I will need it to get the exact regular expression.
I ended up creating a user control consisting of a label,textbox, RequiredFieldValidator, RangeValidator and RegularExpression validator.
my attemp at a reusable numeric textbox. ;)
Post a Comment
I ended up creating a user control consisting of a label,textbox, RequiredFieldValidator, RangeValidator and RegularExpression validator.
my attemp at a reusable numeric textbox. ;)
Subscribe to Post Comments [Atom]
<< Home
Subscribe to Posts [Atom]