List of usage examples for java.lang String matches
public boolean matches(String regex)
From source file:com.salesmanager.core.util.CustomerUtil.java
public static boolean ValidatePhoneNumber(String phNumber) { String msgResult = ""; boolean valResult = false; valResult = phNumber.matches(numPattern); if (valResult) { msgResult = "The phone number validates."; } else {// w w w . j av a 2 s . c o m msgResult = "The phone number does not validate"; } return valResult; }
From source file:com.sapienter.jbilling.server.user.validator.AlphaNumValidator.java
public static boolean basicValidation(String password) { boolean result = true; if (password == null || password.equals("")) { return true; }/* w w w . j ava 2 s . c om*/ if (!password.matches(LETTERS) || !password.matches(NUMBERS)) { result = false; } return result; }
From source file:com.ts.db.connector.ConnectorDriverManager.java
private static boolean isJarFile(String path) { return path.matches("(?i).|\\.(jar|zip)"); }
From source file:Main.java
public static boolean isFixedPhoneNumber(String telNum) { if (TextUtils.isEmpty(telNum)) { return false; }//from w w w . j av a 2s. c o m telNum = telNum.replaceAll("^\\+{0,1}86", ""); boolean flag = false; if (telNum.matches("^0[1|2]\\d[1-9]\\d{4,6}$")) { flag = true; } else if (telNum.matches("^0[3-9]\\d{2}[1-9]\\d{4,5}$")) { flag = true; } return flag; }
From source file:Main.java
/** * Simple compare of strings without namespace preface * * @param nsname name with possible ns preface * @param name name to compare// w ww.ja v a2s .co m */ public static boolean matches(String nsname, String name) { int col = nsname.indexOf(":"); if (col > 0) nsname = nsname.substring(col + 1); return (nsname.matches(name)); }
From source file:heylee.android.network.JSONParserCustom.java
public static String autoBase64Decode(String CheckString) { String BASE64_REGEX = "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$"; if (CheckString.matches(BASE64_REGEX)) { if (CheckString == null || CheckString.isEmpty()) return ""; else//www . ja v a 2 s . co m return new String(Base64.decode(Uri.decode(CheckString), 0)); } return CheckString; }
From source file:Main.java
public static String getNextSection(BufferedReader bufferedReader) throws IOException { String buffer; do {/*from w w w .ja va 2 s .co m*/ buffer = bufferedReader.readLine(); if (buffer == null) { return null; } buffer = buffer.trim(); } while (!buffer.matches("\\[.*\\]")); return buffer.substring(1, buffer.length() - 1); }
From source file:net.certiv.antlr.project.util.Utils.java
public static String scanClassPath(String regex) { String[] pathElements = System.getProperty("java.class.path").split(";"); for (String pe : pathElements) { String lc = pe.toLowerCase(); if (lc.matches(regex)) { Log.info(Utils.class, "Found: " + pe); return pe; }/*from w w w . j av a 2 s . c o m*/ } return null; }
From source file:Main.java
/** * Extracts aggregation-definition-prim-keys out of the table-names of the given sql. * * @param sql sql-statement of report-definition. * @return Collection with aggregation-definition prim keys. */// www . j a v a2 s . c om public static Collection<String> extractAggregationPrimKeysFromSql(final String sql) { final Collection<String> primKeys = new ArrayList<String>(); if (sql != null) { String workSql = sql.replaceAll("\\s+", " "); workSql = workSql.replaceAll("\\s+", " "); boolean condition = false; if (workSql.matches("(?i).* (where|order by|group by) .*")) { condition = true; } final String fromClause = condition ? workSql.replaceFirst("(?i).*?from(.*?)(where|order by|group by).*", "$1") : workSql.replaceFirst("(?i).*?from(.*)", "$1"); final String[] tables = fromClause.split(","); for (String table : tables) { if (table.matches(".*?_.*")) { table = table.replaceFirst(".*?\\.", "").trim(); if (table.startsWith("_")) { table = table.replaceFirst("_", ""); } primKeys.add(table.replaceFirst("(.*?)_.*", "$1")); } } } return primKeys; }
From source file:Main.java
public static boolean isEmail(String str) { String regularExpression = "^([a-z0-9A-Z]+[-|//.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?//.)+[a-zA-Z]{2,}$"; if (isEmpty(str)) { return false; } else if (!str.matches(regularExpression)) { return false; }//from ww w .j a va 2 s . c o m return true; }