Android examples for java.util.regex:Password Pattern
check Password by regex
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean checkPassword(String password) { String passwordRegex = "^[a-zA-Z0-9!@.#$%^&*?_~]{6,16}$"; Pattern p = Pattern.compile(passwordRegex); Matcher m = p.matcher(password); return m.matches(); }//from www .j a v a 2 s . c om }