List of usage examples for java.util.regex Pattern matcher
public Matcher matcher(CharSequence input)
From source file:Main.java
public static boolean checkEmail(Object strObj) { String str = strObj + ""; String match = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"; Pattern pattern = Pattern.compile(match); Matcher matcher = pattern.matcher(str); return matcher.matches(); }
From source file:Main.java
public static boolean isEmailLegal(String email) { if (TextUtils.isEmpty(email)) return false; final String REGEXP = "^([a-z0-9\\-_.+]+)@([a-z0-9\\-]+[.][a-z0-9\\-.]+)$"; Pattern p = Pattern.compile(REGEXP); Matcher m = p.matcher(email.toLowerCase()); return m.matches(); }
From source file:Main.java
public static boolean checkNumber(String username) { Pattern pattern = Pattern.compile("^[0-9]+$"); Matcher matcher = pattern.matcher(username); return matcher.matches(); }
From source file:Main.java
public static boolean isSpecialChar(String str) { Pattern p = Pattern.compile("[!*'\"();:@&=+$,/?%#%]"); Matcher m = p.matcher(str); return m.find(); }
From source file:Main.java
public static boolean validatestr(String str) { Pattern pattern = Pattern.compile("[0-9],."); Matcher matcher = pattern.matcher(str); return matcher.matches(); }
From source file:Main.java
public static String extractMatchString(String regex, String target) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(target); if (matcher.find()) { return matcher.group(1); } else {// w ww.j a v a2 s . co m return null; } }
From source file:Main.java
public static boolean isMobileNoAll(String mobiles) { Pattern p = Pattern.compile("^1[3|4|5|8][0-9]\\d{8}$"); Matcher m = p.matcher(mobiles); return m.matches(); }
From source file:Main.java
public static boolean isShort(String password) { if (password == null || password.equals("")) { Log.d(TAG, "password is null"); return false; }/*w w w . j a v a 2s . c om*/ String strPattern = "^[0-9A-Za-z]{6,}$"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(password); return m.matches(); }
From source file:Main.java
public static List<String> getStringDigit(String text) { text = null == text ? "" : text; List<String> digitList = new ArrayList<String>(); Pattern p = Pattern.compile("(\\d+)"); Matcher m = p.matcher(text); while (m.find()) { String find = m.group(1).toString(); digitList.add(find);/*w w w . ja v a2 s . c o m*/ } return digitList; }
From source file:Main.java
public static boolean isNumeric(String string) { Pattern pattern = Pattern.compile("[0-9]*"); Matcher isNum = pattern.matcher(string.trim()); if (!isNum.matches()) { return false; }/*from www . j a va 2s . c o m*/ return true; }