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:com.chiorichan.util.PermissionUtil.java

public static boolean containsValidChars(String ref) {
    return ref.matches("[a-z0-9_]*");
}

From source file:Main.java

public static String parseUUID(UUID uuid) {
    String s = uuid.toString();
    if (s.matches(b)) {
        s = s.substring(4, 8);//from   w ww  . j  av  a 2  s. c  o  m
    }
    return s;
}

From source file:Main.java

/**
 * Convert an encoding name from the java encoding name
 * which often omits a hyphen in the name to the standard
 * XML encoding name with hyphens.//from  ww  w  .j a v  a  2s .  com
 *
 * @param encodingName The raw name of the encoding.
 * @return The corresponding XML encoding name.
 */
public static String toXmlEncodingName(String encodingName) {
    if (encodingName.matches("UTF\\d{1,2}")) {
        encodingName = encodingName.replace("UTF", "UTF-");
    } else if (encodingName.matches("ISO\\d{4}\\.*")) {
        encodingName = encodingName.replace("ISO", "ISO-");
    }
    return encodingName;
}

From source file:Main.java

public static boolean validatePassword(String password) {
    return password != null && password.matches(PASSWORD_PATTERN);
}

From source file:Main.java

public static boolean isLocalhostDomain(String endpoint) {
    return endpoint.matches("https*://(localhost|127).*");
}

From source file:Main.java

public static boolean isRegexMatch(String str, String regex) {
    return str != null && str.matches(regex);
}

From source file:Main.java

public static boolean isSNaN(String value) {
    if (value.matches("[01]111111111111[01]{51}") && !value.matches("[01]111111111110[0]{51}")) {
        return true;
    }//from   www.  j  av a2s .  c om

    return false;
}

From source file:Main.java

public static boolean isNumberAddress(String numberOrAddress) {
    return numberOrAddress.matches("[-+]?\\d*\\.?\\d+");
}

From source file:Main.java

public static boolean isPwd(String str) {
    boolean result;
    result = str.matches("^[0-9a-zA-Z][\\~!@#$%^&*()_+-={}\\[\\]?/,.]{6,12}$");
    return result;
}

From source file:Main.java

public static boolean isEmpty(final String string) {
    if (null == string || !string.matches(".*\\S+.*")) {
        return true;
    }//from   ww  w . java 2  s .  c  om
    return false;
}