strong password regular expression java
package com.mkyong.regex;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class PasswordValidator{
private Pattern pattern;
private Matcher matcher;
private static final String PASSWORD_PATTERN =
"((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})";
public PasswordValidator(){
pattern = Pattern.compile(PASSWORD_PATTERN);
}
/**
* Validate password with regular expression
* @param password password for validation
* @return true valid password, false invalid password
*/
public boolean validate(final String password){
matcher = pattern.matcher(password);
return matcher.matches();
}
}
Copy
Also in Java:
- how lock horizontal orientation android
- java int to hex fixed length
- parsedouble java
- java thread
- bubble sort in java
- strong password regular expression java
- sending a excel in an attachment in email java
- how to check if a string is in alphabetical order in java
- para que sirve getcontentpane en java
- how to remove all special characters from a string in java
- java create unmodifiable list
- declare class variable in java
- java scanner input int
- Error executing Maven. java.io.FileNotFoundException: The specified user settings file does not exist: /etc/java-8-openjdk
- java get an int from a char
- java lambda list of objects cast
- java loop
- blurview android github
- number to string java
- java create directory
- java collapse string array
- init cap java
- how to open a text file in java
- substring in java