List of usage examples for java.util.regex Pattern matches
public static boolean matches(String regex, CharSequence input)
From source file:Main.java
public static boolean isMatch(String regex, CharSequence input) { return input != null && input.length() > 0 && Pattern.matches(regex, input); }
From source file:Main.java
public static boolean checkDecimals(String decimals) { String regex = "\\-?[1-9]\\d+(\\.\\d+)?"; return Pattern.matches(regex, decimals); }
From source file:Main.java
public static boolean checkEmail(String email) { String regex = "\\w+@\\w+\\.[a-z]+(\\.[a-z]+)?"; return Pattern.matches(regex, email); }
From source file:Main.java
public static boolean isEmail(String email) { if (email == null) return false; boolean b = Pattern.matches("[\\w\\~\\-\\.]+@[\\w\\~\\-]+(\\.[\\w\\~\\-]+)+", email.trim()); return b;/*from www . j a v a 2 s . co m*/ }
From source file:Main.java
public static boolean checkIdCard(String idCard) { String regex = "[1-9]\\d{13,16}[a-zA-Z0-9]{1}"; return Pattern.matches(regex, idCard); }
From source file:Main.java
public static boolean checkPhone(String phone) { String regex = "(\\+\\d+)?(\\d{3,4}\\-?)?\\d{7,8}$"; return Pattern.matches(regex, phone); }
From source file:Main.java
public static boolean checkDecimal(String decimals) { String regex = "(([1-9]\\d*)|0)(\\.\\d{1,2})?"; return Pattern.matches(regex, decimals); }
From source file:Main.java
public static boolean isLandlinePhone(@NonNull String phone) { return Pattern.matches( "(\\d{11})|^((\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})|(\\d{4}|\\d{3})" + "-(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1})|(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1}))$", phone);/*from w w w. j a v a 2s . com*/ }
From source file:Main.java
public static boolean checkBirthday(String birthday) { String regex = "[1-9]{4}([-./])\\d{1,2}\\1\\d{1,2}"; return Pattern.matches(regex, birthday); }
From source file:Main.java
public static boolean matches(String propertyName) { return Pattern.matches(REGEX_CONDITION, propertyName); }