List of usage examples for java.util.regex Matcher matches
public boolean matches()
From source file:Main.java
public static boolean checkEmail(String email) { Pattern pattern = Pattern.compile("^\\w+([-.]\\w+)*@\\w+([-]\\w+)*\\.(\\w+([-]\\w+)*\\.)*[a-z]{2,3}$"); Matcher matcher = pattern.matcher(email); if (matcher.matches()) { return true; }// w ww . jav a 2s . c o m return false; }
From source file:Main.java
public static boolean check(String reg, String string) { boolean tem = false; Pattern pattern = Pattern.compile(reg); Matcher matcher = pattern.matcher(string); tem = matcher.matches(); return tem;//from w w w . jav a 2s.c om }
From source file:Main.java
public static boolean checkPhone(String num) { String mobile = num;//from w w w . ja va2 s .c o m if (TextUtils.isEmpty(mobile)) { return false; } String exp = "(1)[0-9]{10}$"; Pattern p = Pattern.compile(exp); Matcher m = p.matcher(mobile); boolean isPhoneNum = m.matches(); return isPhoneNum; }
From source file:Main.java
public static boolean isEmail(String strEmail) { Pattern pattern = Pattern.compile("[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"); Matcher matcher = pattern.matcher(strEmail); return matcher.matches(); }
From source file:Main.java
public static boolean isPhoneNumber(String phoneNumber) { if (TextUtils.isEmpty(phoneNumber)) { return false; }//w w w. j a v a 2 s. c o m String reg = "^[0-9]{11}$"; Pattern pattern = Pattern.compile(reg); Matcher matcher = pattern.matcher(phoneNumber); return matcher.matches(); }
From source file:Main.java
public static Boolean isValid(String reg, String text) { Pattern pattern = Pattern.compile(reg); Matcher matcher = pattern.matcher(text); return matcher.matches(); }
From source file:Main.java
public static boolean eMailValidation(String emailstring) { Pattern emailPattern = Pattern.compile("[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}" + "\\@" + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" + "(" + "\\." + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" + ")+"); Matcher emailMatcher = emailPattern.matcher(emailstring); return emailMatcher.matches(); }
From source file:Main.java
public static boolean isEmailValid(String email) { String regEx = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; Matcher matcherObj = Pattern.compile(regEx).matcher(email); return matcherObj.matches(); }
From source file:Main.java
public static boolean checkPhoneNumber(String phoneNumber) { if (TextUtils.isEmpty(phoneNumber)) { return false; }/*from www .j a v a 2 s. c om*/ String reg = "^[0-9]{11}$"; Pattern pattern = Pattern.compile(reg); Matcher matcher = pattern.matcher(phoneNumber); return matcher.matches(); }
From source file:Main.java
public static boolean isPuleNumber(String str) { if (TextUtils.isEmpty(str)) { return false; }//from w w w .jav a2 s.c o m String reg = "^\\d*"; Pattern pattern = Pattern.compile(reg); Matcher matcher = pattern.matcher(str); boolean flag = matcher.matches(); return flag; }