Android Password Regex Match matchPwd(String pwd)

Here you can find the source of matchPwd(String pwd)

Description

match Pwd

Declaration

public static boolean matchPwd(String pwd) 

Method Source Code

//package com.java2s;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static boolean matchPwd(String pwd) {
        // if (pwd.length() <8 || pwd.length() >16) {
        // return false;
        // }/*from  w ww .  j  av a 2  s  . c o  m*/
        String str = "^(?![^a-zA-Z]+$)(?!\\D+$).{6,16}$";
        Pattern p = Pattern.compile(str);
        Matcher m = p.matcher(pwd);
        return m.matches();
    }
}

Related

  1. checkpasswd(String passwd)
  2. isValidUserNameOrPassword(String string)