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:classes.InputCheck.java

public static Boolean checkNumbers_NotMandatory(String inputtxt) {
    return inputtxt.matches("^[0-9]{3}|([0-9]*\\.[0-9]+|[0-9]+)$") || !checkStringIsNotBlank(inputtxt);
}

From source file:classes.InputCheck.java

public static Boolean checkPhone(String inputtxt) {
    return inputtxt.matches("^(0|\\+33)[1-9]([-. ]?[0-9]{2}){4}$") && checkStringIsNotBlank(inputtxt);
}

From source file:classes.InputCheck.java

public static Boolean checkPhone_NotMandatory(String inputtxt) {
    return inputtxt.matches("^(0|\\+33)[1-9]([-. ]?[0-9]{2}){4}$") || !checkStringIsNotBlank(inputtxt);
}

From source file:classes.InputCheck.java

public static Boolean checkAlphaChar(String inputtxt) {
    return inputtxt.matches("^[ A-Za-z]+$") && checkStringIsNotBlank(inputtxt);
}

From source file:classes.InputCheck.java

public static Boolean checkAlphaChar_NotMandatory(String inputtxt) {
    return inputtxt.matches("^[ A-Za-z]+$") || !checkStringIsNotBlank(inputtxt);
}

From source file:classes.InputCheck.java

public static Boolean checkDateSQL(String inputtxt) {
    return inputtxt.matches("^(19|20)\\d\\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$");
}

From source file:Main.java

public final static boolean isNumeric(String numberStr) {
    if (numberStr != null && !"".equals(numberStr.trim())) {
        return numberStr.matches("^[0-9]*$");
    } else {//from w  w  w . ja v a  2 s. c  o m
        return false;
    }
}

From source file:classes.InputCheck.java

public static Boolean checkDateFormat(String inputtxt) {
    return inputtxt.matches("^(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)\\d\\d$")
            && checkStringIsNotBlank(inputtxt);
}

From source file:classes.InputCheck.java

public static Boolean checkDateFormat_NotMandatory(String inputtxt) {
    return inputtxt.matches("^(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)\\d\\d$")
            || !checkStringIsNotBlank(inputtxt);
}

From source file:classes.InputCheck.java

public static Boolean checkNumbers(String inputtxt) {
    return inputtxt.matches("^[0-9]{3}|([0-9]*\\.[0-9]+|[0-9]+)$") && checkStringIsNotBlank(inputtxt);

}