List of usage examples for java.util.regex Matcher matches
public boolean matches()
From source file:Main.java
public static boolean isNumber(String str) { String NUMBER_PATTERN = "^\\d+$"; Pattern p = Pattern.compile(NUMBER_PATTERN); Matcher m = p.matcher(str); return m.matches(); }
From source file:Main.java
public static boolean isCorrect(String rgx, String res) { Pattern p = Pattern.compile(rgx); Matcher m = p.matcher(res); return m.matches(); }
From source file:Main.java
public static boolean isEmail(String email) { Pattern p = Pattern.compile(EMAIL_REGULAR); Matcher m = p.matcher(email); return m.matches(); }
From source file:Main.java
public static boolean isMobileNO(String mobiles) { Pattern p = Pattern.compile("^\\d{11}$"); Matcher m = p.matcher(mobiles); return m.matches(); }
From source file:Main.java
public static boolean isUserName(String mobiles) { Pattern p = Pattern.compile("^[A-Za-z\u4e00-\u9fa5]{2,15}$"); Matcher m = p.matcher(mobiles); return m.matches(); }
From source file:Main.java
public static boolean isEmail(String params) { 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(params); return m.matches(); }
From source file:Main.java
public static boolean isPhoneNumber(String mobiles) { Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$"); Matcher m = p.matcher(mobiles); return m.matches(); }
From source file:Main.java
public static boolean isDouble(String str) { Pattern p = Pattern.compile("^\\d+(\\.\\d+)?$"); Matcher m = p.matcher(str); if (m.matches()) { return true; }/*from www.j a v a 2 s . c om*/ return false; }
From source file:Main.java
public static boolean isMobileNum(String mobiles) { Pattern p = Pattern.compile("^((13)|(14)|(15)|(17)|(18))\\d{9}$"); Matcher m = p.matcher(mobiles); return m.matches(); }
From source file:Main.java
/** Validate telephone number **/ public static boolean validatePhone(String phone, int length) { Pattern p = Pattern.compile(String.format("[0-9]{%d}", length), Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(phone); return m.matches(); }