List of usage examples for java.util.regex Matcher matches
public boolean matches()
From source file:Main.java
public static boolean isPasswordValid(String password) { Pattern p = Pattern.compile(PASSWORD_REGULAR); Matcher m = p.matcher(password); return m.matches(); }
From source file:Main.java
public static boolean isMobileNo(String mobiles) { Pattern p = Pattern.compile("^((13[0-9])|(14[0-9])|(15[^4,\\D])|(17[0-9])|(18[0-9]))\\d{8}$"); Matcher m = p.matcher(mobiles); return m.matches(); }
From source file:Main.java
public static boolean isPasswordStronger(String password) { String string = "^(?:(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])|(?=.*[A-Z])(?=.*[a-z])(?=.*[^A-Za-z0-9])|(?=.*[A-Z])(?=.*[0-9])(?=.*[^A-Za-z0-9])|(?=.*[a-z])(?=.*[0-9])(?=.*[^A-Za-z0-9])).{6,}|(?:(?=.*[A-Z])(?=.*[a-z])|(?=.*[A-Z])(?=.*[0-9])|(?=.*[A-Z])(?=.*[^A-Za-z0-9])|(?=.*[a-z])(?=.*[0-9])|(?=.*[a-z])(?=.*[^A-Za-z0-9])|(?=.*[0-9])(?=.*[^A-Za-z0-9])|).{8,}"; Pattern p = Pattern.compile(string); Matcher m = p.matcher(password); return m.matches(); }
From source file:Main.java
public static boolean isMatchEmail(String strEmail) { String strPattern = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(strEmail); return m.matches(); }
From source file:Main.java
public static boolean haveLetter(String password) { String str = ".*[a-zA-Z]+.*"; Pattern p = Pattern.compile(str); Matcher m = p.matcher(password); return m.matches(); }
From source file:Main.java
public static boolean isBankCard(String cardNo) { Pattern p = Pattern.compile("^\\d{16,19}$|^\\d{6}[- ]\\d{10,13}$|^\\d{4}[- ]\\d{4}[- ]\\d{4}[- ]\\d{4,7}$"); Matcher m = p.matcher(cardNo); return m.matches(); }
From source file:Main.java
public static boolean is18IDcard(String idString) { Pattern p = Pattern/*from w w w . ja v a 2s.co m*/ .compile("^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9]|X)$"); Matcher m = p.matcher(idString); return m.matches(); }
From source file:Main.java
public static boolean isEmail(String email) { if (null == email) return false; // Pattern p = Pattern.compile("\\w+@(\\w+.)+[a-z]{2,3}"); Pattern p = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"); Matcher m = p.matcher(email); return m.matches(); }
From source file:Main.java
public static boolean isMobileNO(String mobiles) { Pattern p = Pattern.compile("^((13[0-9])|(14[0-9])|(15[^4,\\D])|(17[0-9])|(18[0-9]))\\d{8}$"); Matcher m = p.matcher(mobiles); return m.matches(); }
From source file:Main.java
public static boolean isCheckCode(String strCode) { String strPattern = "^[0-9a-zA-Z]{6}"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(strCode); return m.matches(); }