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 isFullNameValid(String fullname) {
    return fullname.matches(FULL_NAME_PATTERN);
}

From source file:Main.java

public static String validateId(final String id) {
    if (!id.matches("^\\d+$"))
        throw new IllegalArgumentException("Not correct _ID: " + id);
    return id;//from w  w w. ja v  a2  s  .c o m
}

From source file:Main.java

public static boolean isInputLengthEnough(String username) {

    return username.matches("(\\w|\\d){6,20}");
}

From source file:Main.java

private static boolean isEmailValid(String email) {
    if (!email.matches(EMAIL_FORMAT)) {
        return false;
    }/*from w  ww  .j ava  2  s .  co  m*/
    return true;
}

From source file:org.eclipse.swt.snippets.Snippet19.java

private static void ensureTextContainsOnlyDigits(VerifyEvent e) {
    String string = e.text;
    e.doit = string.matches("\\d*");
    return;//from   w  ww . jav  a  2s. c  o  m
}

From source file:Main.java

public static boolean isCellphone(String cellphone) {

    return cellphone.matches("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
}

From source file:Main.java

public static boolean isEnglish(String charaString) {
    return charaString.matches("^[a-zA-Z]*");
}

From source file:Main.java

public static boolean isPhoneNumberValid(String phoneNumber) {
    return phoneNumber.matches(PhonePattern);
}

From source file:Main.java

public static boolean isNumber(String numberString) {
    return numberString.matches("^[0-9]*$");
}

From source file:Main.java

public static boolean checkString(String s, String regex) {
    return s.matches(regex);
}