List of usage examples for java.util.regex Matcher matches
public boolean matches()
From source file:Main.java
public static boolean isEmail(String emailStr) { String patternStr = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"; Pattern p = Pattern.compile(patternStr); Matcher m = p.matcher(emailStr); return m.matches(); }
From source file:Main.java
public static boolean isEmail(String email) { if (email == null || email.trim().length() == 0) return false; String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$"; Pattern p = Pattern.compile(str); Matcher m = p.matcher(email); return m.matches(); }
From source file:Main.java
public static boolean isMobileNumber(String mobile) { if (mobile.length() != 11) return false; // "^((\\d{7,8})|(0\\d{2,3}-\\d{7,8})|(1[34578]\\d{9}))$" Pattern p = Pattern.compile("^((1[3|5|8][0-9])|(14[5|7])|(17[0|1|6|7|8]))\\d{8}$"); Matcher m = p.matcher(mobile); return m.matches(); }
From source file:Main.java
public static boolean validateFileName(String str) { if (str.trim().length() == 0) { return false; }/*from w w w.j av a 2 s .c om*/ String strPattern = "[^/\\:*?\"<>|]+"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(str); return m.matches(); }
From source file:Main.java
public static boolean isEmail(String strEmail) { String strPattern = "[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9][@][\\w\\-]{1,}([.]([\\w\\-]{1,})){1,3}$"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(strEmail); return m.matches(); }
From source file:Main.java
public static boolean isDandelionNo(String dandelionNo) { Pattern p = Pattern.compile(ACC_REGULAR); Matcher m = p.matcher(dandelionNo); return m.matches(); }
From source file:Main.java
public static boolean checkphone(String phonenumber) { String phone = "\\d{11}"; Pattern p = Pattern.compile(phone); Matcher m = p.matcher(phonenumber); return m.matches(); }
From source file:Main.java
public static boolean isNumeric(String url) { Pattern patt = Pattern.compile("[0-9]*"); Matcher matcher = patt.matcher(url); return matcher.matches(); }
From source file:Main.java
private static boolean Regular(String str, String pattern) { if (null == str || str.trim().length() <= 0) return false; Pattern p = Pattern.compile(pattern); Matcher m = p.matcher(str); return m.matches(); }
From source file:Main.java
public static boolean checkEmail(String s) { String check = "^([a-z0-9A-Z_-]+[-|\\.]?)+[a-z0-9A-Z_]@([a-z0-9A-Z_]+(-[a-z0-9A-Z_]+)?\\.)+[a-zA-Z\\.]{2,}$"; Pattern regex = Pattern.compile(check); Matcher matcher = regex.matcher(s); return matcher.matches(); }