is Valid Password:a-z, A-Z, 0-9 and `~!@#$%^&*()_, length 6-20 - Android java.security

Android examples for java.security:Password

Description

is Valid Password:a-z, A-Z, 0-9 and `~!@#$%^&*()_, length 6-20

Demo Code

import java.util.regex.Pattern;

public class Main {

  public static boolean isValidPwd(String pwd) {
    String regex = "^[a-zA-Z0-9`~!@#$%^&*()_]{6,20}$";
    return Pattern.matches(regex, pwd);
  }/*from www  .j a va 2s  .  c  om*/

}

Related Tutorials