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 hasHost(String link) {
    return link.matches("https?\\:\\/\\/([a-z0-9-.]*)\\.([a-z]{2,5})");
}

From source file:Main.java

public static boolean isNumber(String str) {
    return str.matches("\\d+");
}

From source file:Main.java

public static boolean isUrl(String url) {
    return url.matches("^[a-zA-z]+://[^\\s]*$");
}

From source file:Main.java

public static boolean isValidId(String tail) {
    return tail.matches("[A-Za-z0-9\\-\\.]{1,36}");
}

From source file:Main.java

public static Boolean hasLetter(String text) {
    return text.matches(".*[a-zA-Z]+.*");
}

From source file:Main.java

public static boolean validEmail(String email) {
    return email.matches("[A-Za-z0-9._%+-][A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}");
}

From source file:Main.java

public static boolean isNumeric(String str) {
    return str.matches(NUMBER_FORMAT);
}

From source file:Main.java

public static boolean matchesChinese(String str) {
    return str.matches(MATCHES_CHINESE);
}

From source file:Main.java

public static boolean isValidZipCode(String zip) {
    return zip.matches(zipCodePattern);
}

From source file:Main.java

public static boolean isMapsURL(String url) {
    return url.matches("http[s]://maps\\.google\\.[a-z]{2,3}(\\.[a-z]{2})?[/?].*")
            || url.matches("http[s]://www\\.google\\.[a-z]{2,3}(\\.[a-z]{2})?/maps.*");
}