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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details Strong Password
Expression
^(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{7,30}$
Description
The basic expression requires at least 1 lower case, 1 upper case, 1 numeric, 1 non-word and no whitespace. <br /><br /> The format of the expression lends itself to being parameterised, thus in C# I have a method that returns a modified pattern based on passed in parameters e.g. <br /><br />return "^(?=(.*[a-z]){" + minLowerCase.ToString() + ",})"<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ "(?=(.*[\d]){" + minNumeric.ToString() + ",})"<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;... <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ ".{" + minLength.ToString() + "," + maxLength.ToString() + "}$");<br /><br />Its then possible to set the password strength via configuration files which require strong passwords in production environments, but allow weaker passwords in development environments.
Matches
qW1@xxx
Non-Matches
qwerty123
Author Rating: Not yet rated. Chris Stead
   Displaying page 1 of 1 pages; Items 1 to 1

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