Java Regex Password Validate passwordValidator(String password)

Here you can find the source of passwordValidator(String password)

Description

password Validator

License

Open Source License

Declaration

public static boolean passwordValidator(String password) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static boolean passwordValidator(String password) {

        String passwordPattern = "^[a-z0-9_-]{3,15}$";

        validate(password, passwordPattern);

        return validate(password, passwordPattern);
    }//from  w ww . jav a2 s.  c  o  m

    private static boolean validate(String string, String strPattern) {
        Pattern pattern;
        Matcher matcher;

        pattern = Pattern.compile(strPattern);
        matcher = pattern.matcher(string);
        return matcher.matches();
    }
}

Related

  1. passwordContainInvalidCharacter(String password)
  2. passwordIsValid(String password)
  3. passwordValidation()
  4. passwordValidation(String password)