Here you can find the source of passwordValidator(String password)
public static boolean passwordValidator(String password)
//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(); } }