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 isValid_id(String str) {
    String regex1 = "[0-9]{17}x";
    String regex2 = "[0-9]{15}";
    String regex3 = "[0-9]{18}";
    return str.matches(regex1) || str.matches(regex2) || str.matches(regex3);
}

From source file:Main.java

public static Boolean isUerrId(String str) {
    Boolean isUerrId = false;/* www.  j  a v a 2  s. c o m*/
    String expr = "^([a-zA-Z]){1}+[a-z0-9A-Z-_]{5,19}$";
    if (str.matches(expr)) {
        isUerrId = true;
    }
    return isUerrId;
}

From source file:com.google.wave.api.Util.java

/**
 * Returns {@code true} if the given string is null, empty, or comprises only
 * whitespace characters.// ww w.j a va  2  s.  com
 * 
 * @param string the string reference to check
 * @return {@code true} if {@code string} is null, empty, or consists of
 *     whitespace characters only
 */
public static boolean isEmptyOrWhitespace(@Nullable String string) {
    return string == null || string.matches("\\s*");
}

From source file:com.wms.studio.api.utils.StringUtils.java

public static boolean checkEmail(String email) {
    if (isBlank(email)) {
        return false;
    }/* w w  w . jav a2  s  . c o  m*/
    return email.matches(EMAIL_REGEX);
}

From source file:Main.java

public static boolean isQNaN(String value) {
    if (value.matches("[01]111111111110[01]{51}") && !value.matches("[01]111111111110[0]{51}")) {
        return true;
    }//from ww w . j  av  a  2s  .  c o m

    return false;

}

From source file:com.zilotti.utils.NetworkUtils.java

public static boolean isIpV4(String ipAddress) {
    return ipAddress.matches(IPV4_REGEX);
}

From source file:com.zilotti.utils.NetworkUtils.java

public static boolean isIpV6_Hex4DecCompressed(String ipAddress) {
    return ipAddress.matches(IPV6_HEX4DECCOMPRESSED_REGEX);
}

From source file:com.zilotti.utils.NetworkUtils.java

public static boolean isIpV6_Hex4Dec(String ipAddress) {
    return ipAddress.matches(IPV6_HEX4DECCOMPRESSED_REGEX);
}

From source file:com.zilotti.utils.NetworkUtils.java

public static boolean isIpV6_HexCompressed(String ipAddress) {
    return ipAddress.matches(IPV6_HEXCOMPRESSED_REGEX);
}

From source file:Main.java

public static boolean isDateYM(String str) {
    if (isEmpty(str))
        return false;
    //      return str.matches("^\\d{4}[0-1][0-9]$");
    return str.matches("^\\d{4}(0[1-9]|1[0-2])$");
}