List of usage examples for java.util.regex Pattern matcher
public Matcher matcher(CharSequence input)
From source file:Main.java
public static boolean isUserName(String userName) { String strPattern = "^([u4e00-u9fa5]|[ufe30-uffa0]|[a-zA-Z0-9_]){3,12}$"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(userName); return m.matches(); }
From source file:Main.java
public static boolean isNumeric(String str) { Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); return pattern.matcher(str).matches(); }
From source file:Main.java
public static boolean isEmail(String email) { Pattern p = Pattern.compile(EMAIL_REGULAR); Matcher m = p.matcher(email); return m.matches(); }
From source file:Main.java
public static boolean isEmail(String emailStr) { String patternStr = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"; Pattern p = Pattern.compile(patternStr); Matcher m = p.matcher(emailStr); return m.matches(); }
From source file:Main.java
public static boolean checkPhoneNum(String userPhone) { String regExp = "^((13[0-9])|(14[0-9])|(15[0-9])|(17[0-9])|(19[0-9])|(18[0-9]))\\d{8}$"; Pattern p = Pattern.compile(regExp); Matcher m = p.matcher(userPhone); return m.matches(); }
From source file:Main.java
public static boolean isEmail(String strEmail) { String strPattern = "[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9][@][\\w\\-]{1,}([.]([\\w\\-]{1,})){1,3}$"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(strEmail); return m.matches(); }
From source file:Main.java
public static boolean checkNumberPattern(String value, int intlen, int pointlen) { String ps = "^([0-9]{1," + intlen + "})$|^(-[0-9]{1," + intlen + "})$|^([0-9]{1," + intlen + "}.[0-9]{1," + pointlen + "})$|^(-[0-9]{1," + intlen + "}.[0-9]{1," + pointlen + "})$"; Pattern p = Pattern.compile(ps); Matcher m = p.matcher(value); if (!m.matches()) { return false; }// w ww.j a v a2s . co m return true; }
From source file:Main.java
public static boolean isQQ(String qq) { Pattern p = Pattern.compile("^[0-9]{4,11}$"); Matcher m = p.matcher(qq); return m.matches(); }
From source file:Main.java
public static boolean parseOptionalBooleanAttr(String line, Pattern pattern) { Matcher matcher = pattern.matcher(line); if (matcher.find()) { return BOOLEAN_YES.equals(matcher.group(1)); }//from w ww.j a va 2 s . c o m return false; }
From source file:Main.java
public static boolean checkIfInteger(String str) { Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); return pattern.matcher(str).matches(); }