List of usage examples for java.lang String matches
public boolean matches(String regex)
From source file:classes.InputCheck.java
public static Boolean checkMail(String inputtxt) { return inputtxt.matches("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$") && checkStringIsNotBlank(inputtxt); }
From source file:classes.InputCheck.java
public static Boolean checkMail_NotMandatory(String inputtxt) { return inputtxt.matches("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$") || !checkStringIsNotBlank(inputtxt); }
From source file:Main.java
public static boolean isEmailByRegex(String email) { String regex = "^[A-Za-z0-9]{1,40}@[A-Za-z0-9]{1,40}\\.[A-Za-z]{2,3}$"; return email.matches(regex); }
From source file:Main.java
private static boolean matches(String[] filters, Matcher matcher) { for (String filter : filters) { // Is logcat filter? if (filter.matches("(\\w+|\\*):[\\w|\\*]")) { String[] matches = filter.split(":"); // Tag and level match? if ((matches[0].equals("*") || matches[0].equals(matcher.group(6))) && (matches[1].equals("*") || matches[1].equals(matcher.group(5)))) { return true; }// w w w .j a va2 s.co m } else { Pattern pattern = Pattern.compile(".*" + Pattern.quote(filter) + ".*", Pattern.CASE_INSENSITIVE); for (int i = 1; i < 8; i++) { if (pattern.matcher(matcher.group(i)).matches()) { return true; } } } } return false; }
From source file:Main.java
public static boolean enclosureTypeValid(String type) { if (type == null) { return false; } else {/*from w w w. jav a2 s . c o m*/ return type.matches(VALID_MIMETYPE); } }
From source file:Main.java
private static boolean isInternalRef(final String reference) { if (reference == null) { return false; }/*www .j a v a 2s .c o m*/ return reference.matches("[A-Z_]+"); }
From source file:com.sisrni.converter.EtapaMovilidadConverter.java
public static boolean isNumeric(String str) { return (str.matches("[+-]?\\d*(\\.\\d+)?") && str.equals("") == false); }
From source file:org.springsource.restbucks.payment.CreditCardNumber.java
/** * Returns whether the given {@link String} is a valid {@link CreditCardNumber}. * /*from ww w .ja va2 s . c o m*/ * @param number * @return */ public static boolean isValid(String number) { return number == null ? false : number.matches(regex); }
From source file:Main.java
public static boolean isLegalID(String idNumber) { boolean result = idNumber.matches("[0-9]{17}[0-9X]"); if (result) { int year = Integer.parseInt(idNumber.substring(6, 10)); int month = Integer.parseInt(idNumber.substring(10, 12)); int date = Integer.parseInt(idNumber.substring(12, 14)); switch (month) { case FEBRUARY: result = (date >= 1) && (year % 4 == 0 ? date <= 29 : date <= 28); break; case JANUARY: case MARCH: case MAY: case JULY: case AUGUST: case OCTOBER: case DECEMBER: result = (date >= 1) && (date <= 31); break; case APRIL: case JUNE: case SEPTEMBER: case NOVEMBER: result = (date >= 1) && (date <= 30); break; default:/*from w ww . ja v a 2s . co m*/ result = false; break; } } return result; }
From source file:Main.java
public static boolean isUrlOfHost(String url, String host) { if (url != null && host != null) { String urlHost = Uri.parse(url).getHost(); if (urlHost != null) { return urlHost.matches("^(.+\\.)?" + host + "$"); }// www.ja v a2s . c om } return false; }