List of usage examples for java.util.regex Pattern matcher
public Matcher matcher(CharSequence input)
From source file:Main.java
public static boolean checkEmail(String email) { String ps = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$"; Pattern p = Pattern.compile(ps); Matcher m = p.matcher(email); if (!m.matches()) { return false; }/*from w ww . j av a 2 s.c o m*/ return true; }
From source file:Main.java
public static boolean checkMobilePhone(String mobilePhone) { String ps = "^(13|14|15|17|18)\\d{9}$"; Pattern p = Pattern.compile(ps); Matcher m = p.matcher(mobilePhone); if (!m.matches()) { return false; }/*from www.j av a 2 s .co m*/ return true; }
From source file:Main.java
public static boolean isCardId(String str) { boolean flag = false; // /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; String check = "(^\\d{18}$)|(^\\d{15}$)|(^\\d{17}(\\d|X|x)$)"; Pattern pattern = Pattern.compile(check); flag = pattern.matcher(str).matches(); return flag;/* ww w. j a v a 2 s .c om*/ }
From source file:Main.java
public static boolean RegexMatches(String str) { String pattern = "(13\\d|14[57]|15[^4,\\D]|17[678]|18\\d)\\d{8}|170[059]\\d{7}"; Pattern r = Pattern.compile(pattern); Matcher m = r.matcher(str); return m.matches(); }
From source file:Main.java
public static boolean checkPhone_2(String phone) { Pattern p = Pattern.compile("^1\\d{10}$"); Matcher m = p.matcher(phone); return m.matches(); }
From source file:Main.java
public static boolean isNumeric(String str) { if (str == null || (str.trim().equals(""))) { return false; }//from w w w . j a v a 2 s .co m Pattern pattern = Pattern.compile("[0-9]*"); return pattern.matcher(str).matches(); }
From source file:Main.java
public static Boolean isEnglishName(String input) { if (!input.contains("/")) { return false; }/*from w w w . j a v a 2 s . c om*/ String str = "^[a-zA-Z][a-z A-Z/]*$"; Pattern p = Pattern.compile(str); Matcher m = p.matcher(input); 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 ChekIsEmpty(String content) { Pattern p = Pattern.compile("^[^\\s]+$"); Matcher m = p.matcher(content); return m.matches(); }
From source file:Main.java
public static boolean isAlpha(String str) { String strPattern = "[a-zA-Z]+$"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(str); return m.matches(); }