Example usage for java.util.regex Pattern matcher

List of usage examples for java.util.regex Pattern matcher

Introduction

In this page you can find the example usage for java.util.regex Pattern matcher.

Prototype

public Matcher matcher(CharSequence input) 

Source Link

Document

Creates a matcher that will match the given input against this pattern.

Usage

From source file:Main.java

public static boolean isOToN(String number) {
    Pattern p = Pattern.compile("\\d");
    Matcher m = p.matcher(number);
    return m.matches();
}

From source file:Main.java

public static boolean isValid_mail(String email) {
    String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([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 email) {
    Pattern pattern = Patterns.EMAIL_ADDRESS;
    return pattern.matcher(email).matches();
}

From source file:Main.java

public static boolean checkName(String name) {
    String str = "^([\\w]|[\\u4e00-\\u9fa5])+";
    Pattern p = Pattern.compile(str);
    Matcher m = p.matcher(name);
    return m.matches();
}

From source file:Main.java

public static boolean isEmail(String email) {
    String str = "^([a-zA-Z0-9]*[-_.]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]*[-_]?[a-zA-Z0-9]+)+[\\.][A-Za-z]{2,3}([\\.][A-Za-z]{2})?$";
    Pattern p = Pattern.compile(str);
    Matcher m = p.matcher(email);
    return m.matches();
}

From source file:Main.java

public static boolean isBankNameValid(String bankName) {
    String regex = "[A-Z|a-z ]*";
    Pattern pattern = Pattern.compile(regex);
    return pattern.matcher(bankName).matches();
}

From source file:Main.java

public static boolean haveLetter(String password) {
    String str = ".*[a-zA-Z]+.*";
    Pattern p = Pattern.compile(str);
    Matcher m = p.matcher(password);
    return m.matches();
}

From source file:Main.java

public static boolean isEmail(String email) {
    String regex = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
    Pattern p = Pattern.compile(regex);
    Matcher m = p.matcher(email);
    return m.find();
}

From source file:Main.java

public static boolean hasSpecialCharExceptSpace(String x) {
    Pattern p = Pattern.compile("[^a-zA-Z0-9 ]");
    return p.matcher(x).find();
}

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();
}