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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Password with n numbers of digits, upper case character and special character.
Expression
(?=^.{12,25}$)(?=(?:.*?\d){2})(?=.*[a-z])(?=(?:.*?[A-Z]){2})(?=(?:.*?[!@#$%*()_+^&}{:;?.]){2})(?!.*\s)[0-9a-zA-Z!@#$%*()_+^&]*$
Description
User can specify n numbers of digits, upper case character and special character. In this example, we will use two special characters, digits and upper case in the password. Explanation: (?=^.{12,25}$) -- password length range from 12 to 25 (?=(?:.*?[!@#$%*()_+^&}{:;?.]){2}) -- at least 2 special characters (!@#$%*()_+^&}{:;?.}) (?=(?:.*?\d){2}) -- at least 2 digits (?=.*[a-z]) -- characters a-z (?=.{2,}[A-Z]) -- at least 2 upper case characters
Matches
PassW0rd@1*3, pAsSword@#123
Non-Matches
PassW0rd@1*, PassW0rd@1*3', PassW0rd@1 3p
Author Rating: Not yet rated. Bryian Tan
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: CISO
Name: Mike Brown
Date: 2/11/2014 4:04:07 PM
Comment:
This does not require upper case.


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