RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Password Validation
Expression
^.*(?=.{6,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[\W]).*$
Description
Well, I don't remember where from I got this expression, but I modified it a bit to work with asp.net 2.0's Regular expression validator. This validates if the password has atleast 6 characters, of which, atleast 1 character has to be Upper case, atleast 1 lower case, atleast 1 number and atleast one non-word character(say special symbols). Hope this is helpful.
Matches
Aa@123
Non-Matches
abcde, ASaa
Author Rating: The rating for this expression. Sravan
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Close... but not quite
Name: Lynn M.
Date: 4/7/2017 1:06:51 AM
Comment:
I was using this for EXACTLY the described validation in an ASP page, but discovered that I can either enter all capital letters or all lower case, and it doesn't complain... so something is just a bit off if I don't have one of each, I would expect it to fail validation. abc123! ABC123! Both of those are acceptable during validation... and these REGEX expressions make my eyes blur. :-) Thanks. Lynn UPDATE: Never Mind... I had an error with my code where I was passing it in. I had: myRegExp.IgnoreCase = True It should have been myRegExp.IgnoreCase = False


Title: Close... but not quite
Name: Lynn M.
Date: 4/7/2017 1:05:02 AM
Comment:
I was using this for EXACTLY the described validation in an ASP page, but discovered that I can either enter all capital letters or all lower case, and it doesn't complain... so something is just a bit off if I don't have one of each, I would expect it to fail validation. abc123! ABC123! Both of those are acceptable during validation... and these REGEX expressions make my eyes blur. :-) Thanks. Lynn


Title: Close... but not quite
Name: Lynn M.
Date: 4/7/2017 1:04:49 AM
Comment:
I was using this for EXACTLY the described validation in an ASP page, but discovered that I can either enter all capital letters or all lower case, and it doesn't complain... so something is just a bit off if I don't have one of each, I would expect it to fail validation. abc123! ABC123! Both of those are acceptable during validation... and these REGEX expressions make my eyes blur. :-) Thanks. Lynn


Title: Close... but not quite
Name: Lynn M.
Date: 4/7/2017 12:57:04 AM
Comment:
I was using this for EXACTLY the described validation in an ASP page, but discovered that I can either enter all capital letters or all lower case, and it doesn't complain... so something is just a bit off if I don't have one of each, I would expect it to fail validation. abc123! ABC123! Both of those are acceptable during validation... and these REGEX expressions make my eyes blur. :-) Thanks. Lynn


Title: Developer
Name: Wes
Date: 10/23/2008 4:43:41 PM
Comment:
Fantastic! I'm not very good with regular expressions and I actually needed one that did exactly this. I have tried to modify a couple of others I found and even tried to write my own (disaster) so this was a great help. Thanks!


Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials