List of usage examples for java.lang String matches
public boolean matches(String regex)
From source file:Main.java
public static boolean isUTMCoordNum(String baseString) { return baseString.matches("^[0-9]* [0-9]+ [0-9]+$"); }
From source file:Main.java
public static boolean hasTableName(String columnSelection) { return columnSelection.matches("\\w+\\.\\w+"); }
From source file:Main.java
public static boolean validateMobilePhone(String mobilePhone) { if (mobilePhone.matches(("1\\d{10}"))) { return true; }/*from w w w . ja va 2 s . c o m*/ return false; }
From source file:Main.java
public static boolean isUTMCoordDigraph(String baseString) { return baseString.matches("^[0-9]*[a-zA-Z]{3}+[0-9]+$"); }
From source file:Main.java
public static String formatBattletagForWebService(String battletag) { if (battletag.matches(VALID_BATTLETAG_PATTERN_POUND)) { battletag = battletag.replaceFirst("#", "-"); }/* w ww . j av a2 s .c o m*/ return battletag; }
From source file:Main.java
public static boolean validateVISA(String passportNo) { if (passportNo.matches(regexVISA)) { return true; } else {/*from w w w . j ava 2s . c om*/ return false; } }
From source file:Main.java
/** * Check if the passed argument is a unicast MAC address.<br> * A unicast MAC address is the one with an even second hex.<br> * i.e. x[0,2,4,6,8,a,c,e]:xx:xx:xx:xx:xx * //ww w. j a va 2 s . c om * @return true if address is a unicast MAC address and false if not. */ public static boolean isValidMACAddress(String address) { if (!address.matches("^[0-9a-fA-F][02468aceACE][:-]?([0-9a-fA-F]{2}[:-]?){4}[0-9a-fA-F]{2}$")) return false; return true; }
From source file:Main.java
public static boolean isValid(String s) { return (!s.isEmpty() && s.matches("[0-9]*\\.?[0-9]*")); }
From source file:Main.java
public static boolean isValidInt(String s) { return (!s.isEmpty() && s.matches("[0-9]*")); }
From source file:Main.java
/** * This method checks whether the String inDate is a valid date following * the format "yyyy-MM-dd"./* w ww . ja v a 2 s.c om*/ * * @param dateString the string to be checked. * @return true/false depending on whether the string is a date according to the format "yyyy-MM-dd". */ public static boolean dateIsValid(String dateString) { return dateString.matches(DEFAULT_DATE_REGEX); }