Example usage for java.lang String matches

List of usage examples for java.lang String matches

Introduction

In this page you can find the example usage for java.lang String matches.

Prototype

public boolean matches(String regex) 

Source Link

Document

Tells whether or not this string matches the given regular expression.

Usage

From source file:Main.java

public static boolean isInteger(String str) {
    return (str.matches("^-?\\d+$"));
}

From source file:Main.java

public static boolean isNameValid(String name) {
    return name.matches(NamePattern);
}

From source file:Main.java

public static boolean ValidateEmail(String email) {
    return (email.matches("^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,4})+$"));
}

From source file:Main.java

public static boolean isNumeric(String str) {
    return str.matches("[0-9]*");
}

From source file:Main.java

public static boolean isEmailValid(String email) {
    return email.matches(EmailPattern);
}

From source file:Main.java

public static boolean checkEmail(String email) {
    return email.matches(
            "^[_A-Za-z0-9-]+(\\." + "[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*" + "(\\.[A-Za-z]{2,})$");
}

From source file:Main.java

public static boolean isValidEmailAddress(String email) {
    return email.matches(EMAIL_REGEXP);
}

From source file:Main.java

public static boolean isPhoneNumberValid(String phone) {
    return phone.matches(PHONE_PATTERN);
}

From source file:Main.java

public static boolean validatePassword(String password) {
    return password.matches("(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20}");
}

From source file:Main.java

public static boolean isEmail(String email) {

    return email.matches("^(\\w)+(\\.\\w+)*@(\\w)+((\\.\\w+)+)$");
}