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 isValidTagAndAlias(String s) {
    Pattern p = Pattern.compile("^[\u4E00-\u9FA50-9a-zA-Z_-]{0,}$");
    Matcher m = p.matcher(s);
    return m.matches();
}

From source file:Main.java

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

From source file:Main.java

public static boolean isPassWordIllegal(String pwd) {
    Pattern p = Pattern.compile("/(?!^\\d+$)(?!^[a-zA-Z]+$)[0-9a-zA-Z]{6,12}/");
    Matcher m = p.matcher(pwd);
    return m.matches();
}

From source file:Main.java

public static boolean isPassword(String str) {
    Pattern p = Pattern.compile("^[a-zA-Z0-9]{6,12}$");
    Matcher m = p.matcher(str);
    return m.matches();
}

From source file:Main.java

public static boolean isValid_bec_kdh(String kdh) {
    Pattern p = Pattern.compile("^CN\\d{3}");
    Matcher m = p.matcher(kdh);
    return m.matches();
}

From source file:Main.java

public static boolean isChineseBlank(String str) {
    String regex = "^[^\\s\u4e00-\u9fa5]{6,16}$";
    Pattern p = Pattern.compile(regex);
    Matcher m = p.matcher(str);
    return m.matches();
}

From source file:Main.java

public static boolean isID(String s) {
    String strPattern = "^\\d{15}|^\\d{17}([0-9]|X|x)$";
    Pattern p = Pattern.compile(strPattern);
    Matcher m = p.matcher(s);
    return m.matches();
}

From source file:Main.java

public static boolean isIDCard(String str) {
    Pattern p = Pattern.compile("\\d{15}|\\d{18}");
    Matcher m = p.matcher(str);
    return m.matches();
}

From source file:Main.java

public static boolean isTel(String tel) {
    Pattern p = Pattern.compile("^((\\d{7,8})|(0\\d{2,3}-\\d{7,8})|(1[34578]\\d{9}))$");
    Matcher m = p.matcher(tel);
    return m.matches();
}

From source file:Main.java

public static boolean isChinese(String str) {
    Pattern p = Pattern.compile("^[\\u4E00-\\u9FA5\\uF900-\\uFA2D]+$");
    Matcher m = p.matcher(str);
    return m.matches();
}