List of usage examples for java.lang String matches
public boolean matches(String regex)
From source file:com.adobe.acs.commons.mcp.util.StringUtil.java
public static boolean isHex(String str) { return str.matches("^[0-9A-Fa-f-]+$"); }
From source file:Main.java
public static Boolean EmailCheck(String str) { if (str.toString().length() > 0 && !str.matches("^\\w+@\\w+\\.(com|cn)")) { return false; } else/* w w w. j a v a 2 s.c o m*/ return true; }
From source file:Main.java
/** * Prepare and sanitize a string to be used as parameter for a command * @param s/*from w w w. j a v a 2 s. c o m*/ * @return A string safe to use as parameter for a command */ public static String optionalShellEscape(String s) { if (s.matches("[a-zA-Z0-9/._-]+")) return s; return shellEscape(s); }
From source file:Main.java
public static boolean isRightHexStr(String str) { String reg = "^[0-9a-fA-F]+$"; return str.matches(reg); }
From source file:Main.java
public static boolean isIP(String str) { boolean b = false; if (str.matches("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}")) { String s[] = str.split("\\."); if (Integer.parseInt(s[0]) < 255) if (Integer.parseInt(s[1]) < 255) if (Integer.parseInt(s[2]) < 255) if (Integer.parseInt(s[3]) < 255) b = true;// ww w .j ava 2 s . com } return b; }
From source file:Main.java
public static boolean isValidIdCard(String paramString) { return (paramString != null) && (paramString.matches(ID_CARD_REG)); }
From source file:Main.java
public static Boolean checkNum(String emil) { String str = "[0-9_]{1,20}"; if (!emil.matches(str)) { return false; }//from www .ja v a 2s . c o m return true; }
From source file:Main.java
public static boolean isQQ(String QQ) { String regex = "^[1-9]\\d{4,11}$"; return QQ.matches(regex); }
From source file:Main.java
static boolean isValidEmailAddress(String email) { String EMAIL_REGEX = "^[\\w-_\\.+]*[\\w-_\\.]\\@([\\w]+\\.)+[\\w]+[\\w]$"; return email.matches(EMAIL_REGEX); }
From source file:Main.java
public static boolean isASII(String keys) { String regex = "[\\x00-\\xff]+"; return keys.matches(regex); }