Example usage for java.util.regex Matcher matches

List of usage examples for java.util.regex Matcher matches

Introduction

In this page you can find the example usage for java.util.regex Matcher matches.

Prototype

public boolean matches() 

Source Link

Document

Attempts to match the entire region against the pattern.

Usage

From source file:Main.java

public static boolean isPhone(String inputText) {
    Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,0-9]))\\d{8}$");
    Matcher m = p.matcher(inputText);
    return m.matches();
}

From source file:Main.java

public static boolean isPhoneNumber(String str) {
    Pattern phone = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
    Matcher ma = phone.matcher(str);
    return ma.matches();
}

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 isName(String str) {
    Pattern p = Pattern.compile("^[\\u4E00-\\u9FFF]+$");
    Matcher matcher = p.matcher(str);
    return matcher.matches();
}

From source file:Main.java

public static boolean checkEmailIsOK(String emailStr) {
    Pattern p = Pattern.compile("\\w+@(\\w+.)+[a-z]{2,3}");
    Matcher m = p.matcher(emailStr);
    return m.matches();
}

From source file:Main.java

public static boolean isNormalName(String name) {
    Pattern p = Pattern.compile("([A-Za-z0-9\u4E00-\u9FA5]+)");
    Matcher m = p.matcher(name);
    if (m.matches()) {
        return true;
    } else {//from w ww. ja  v  a 2  s . co m
        return false;
    }
}

From source file:Main.java

public static boolean isEmail(String email) {
    String str = "^([\\w-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
    Pattern p = Pattern.compile(str);
    Matcher m = p.matcher(email);
    return m.matches();

}

From source file:Main.java

public static boolean isValidEmail(String s) {
    if (TextUtils.isEmpty(s)) {
        return false;
    }//from w  ww  . jav  a2  s. com
    String strPattern = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
    Pattern p = Pattern.compile(strPattern);
    Matcher m = p.matcher(s);
    return m.matches();
}

From source file:Main.java

public static boolean isMobileNO(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 isValid_phone(String mobiles) {
    Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
    Matcher m = p.matcher(mobiles);

    return m.matches();
}