Java examples for java.util.regex:Match Password
check Password with regex, only number and letter, length 6-10
//package com.java2s; import java.util.regex.Pattern; public class Main { public static void main(String[] argv) throws Exception { String password = "java2s.com"; System.out.println(checkPassword(password)); }//from www . ja v a 2s. co m public static boolean checkPassword(String password) { String regex = "^[0-9a-zA-Z]{6,10}$"; return Pattern.matches(regex, password); } }