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 regexCode2(String str) {
    Pattern pattern = Pattern.compile("^[0-9]*$"); // TODO
    Matcher isNum = pattern.matcher(str);
    return isNum.matches();
}

From source file:Main.java

public static boolean regexPhone(String str) {
    Pattern pattern = Pattern.compile("^((13|14|15|17|18)+)\\d{9}$");
    Matcher isNum = pattern.matcher(str);
    return isNum.matches();
}

From source file:Main.java

public static boolean isMatchPassword(String str) {
    Pattern pattern = Pattern.compile("[a-zA-Z0-9]{6,16}");
    Matcher isNum = pattern.matcher(str);
    return isNum.matches();
}

From source file:Main.java

public static boolean regexName(String str) {
    Pattern pattern = Pattern.compile("[\u4e00-\u9fa5a-zA-Z]{2,24}");
    Matcher isNum = pattern.matcher(str);
    return isNum.matches();
}

From source file:Main.java

private static boolean isNumeric(String str) {
    Pattern pattern = Pattern.compile("[0-9]*");
    Matcher isNum = pattern.matcher(str);
    return isNum.matches();
}

From source file:Main.java

public static boolean isValidMobile(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();

}

From source file:Main.java

public static boolean isValidUserId(String userid) {
    Pattern p = Pattern.compile("^((14[5,7])|(13[0-9])|(15[^4,\\D])|(18[0-3,5-9]))\\d{8}$");
    Matcher matcher = p.matcher(userid);

    return matcher.matches();
}

From source file:Main.java

public static boolean isNumeric(String str) {
    Pattern pattern = Pattern.compile("[0-9]*");
    Matcher isNum = pattern.matcher(str);
    return isNum.matches();
}

From source file:Main.java

public static Boolean isEnglishName(String input) {
    if (!input.contains("/")) {
        return false;
    }/*w  w  w . ja  v a  2s . co m*/
    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 regexIs(String str, String regex) {
    Pattern pattern = Pattern.compile(regex);
    Matcher isNum = pattern.matcher(str);
    return isNum.matches();
}