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.hightern.fckeditor.tool.UtilsFile.java

/**
 * Checks if a filename contains more than one dot.
 * /*w ww. ja  v  a 2  s.co m*/
 * @param filename
 *            filename to check
 * @return <code>true</code> if filename contains severals dots, else <code>false</code>
 */
public static boolean isSingleExtension(final String filename) {
    return filename.matches("[^\\.]+\\.[^\\.]+");
}

From source file:com.prepaird.objectgraphdb.utils.Utils.java

public static boolean isValidRecordId(String id) {
    return id != null && id.matches("^#-?[0-9]*:-?[0-9]*$");
}

From source file:Main.java

public static boolean isValidEmailAddress(String email) {

    String EMAIL_REGEX = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
            + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";

    return email.matches(EMAIL_REGEX);
    //        Pattern p = Pattern.compile(EMAIL_REGEX);
    //        if (!(p.matcher(email).matches()))
    //            return false;
    //        return true;
}

From source file:org.springjutsu.validation.util.PathUtils.java

/**
 * Use to determine if a path contains an ${EL} fragment.
 * @param path Path to check for EL fragments
 * @return true if the path contains an EL fragment.
 *///from  w  ww.  ja  va 2  s . com
public static boolean containsEL(String path) {
    return path.matches(".*\\$\\{.+\\}.*");
}

From source file:org.springjutsu.validation.util.PathUtils.java

/**
 * Use to determine if a an entire path is an EL expression.
 * @param path Path to check for an EL expression
 * @return true if the path contains an EL expression.
 *//*from w  w w. j a va  2s.  c  o m*/
public static boolean isEL(String path) {
    return path.matches("\\$\\{.+\\}");
}

From source file:Main.java

public static Boolean isEmail(String str) {
    Boolean isEmail = false;/*from  w  w w.ja v a2s.c  o m*/
    String expr = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
    if (str.matches(expr)) {
        isEmail = true;
    }
    return isEmail;
}

From source file:com.mirth.connect.util.TcpUtil.java

public static boolean isValidHexString(String str) {
    return str.matches("^[0-9A-F]*$");
}

From source file:controller.Parser.java

static boolean validObj(String objective) {
    return objective.matches(objreg);
}

From source file:adalid.util.info.JavaInfo.java

private static boolean extensionNameMatches(Manifest manifest, String regex) {
    if (StringUtils.isBlank(regex)) {
        return true;
    }//from  w  ww .  j  ava  2s  .c  o m
    Attributes attributes = manifest.getMainAttributes();
    Object object = attributes.get(Attributes.Name.EXTENSION_NAME);
    if (object instanceof String) {
        String string = (String) object;
        return string.matches(regex);
    }
    return false;
}

From source file:controller.Parser.java

static boolean validConstraint(String constraint) {
    return constraint.matches(conreg);
}