List of usage examples for java.util.regex Pattern compile
public static Pattern compile(String regex)
From source file:Main.java
public static boolean verifyEmail(String email) { Pattern pattern = Pattern.compile( "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$"); Matcher matcher = pattern.matcher(email); return matcher.matches(); }
From source file:Main.java
public static boolean verifyEmail(String email) { Pattern pattern = Pattern.compile("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)" + "|(([a-zA-Z0-9\\-]+\\.)+))" + "([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$"); Matcher matcher = pattern.matcher(email); return matcher.matches(); }
From source file:Main.java
public static boolean isData(String number) { Pattern pattern = Pattern.compile("^[0-9]*$"); Matcher m = pattern.matcher(number); if (m.matches()) { return true; } else {//w ww .j a v a2s. c o m return false; } }
From source file:Main.java
public static boolean verifyPassword(String pwd) { Pattern pattern = Pattern.compile("^[a-zA-Z0-9]{6,16}$"); Matcher matcher = pattern.matcher(pwd); return matcher.matches(); }
From source file:Main.java
public static boolean isNumeric(String string) { Pattern pattern = Pattern.compile("[0-9]*"); Matcher isNum = pattern.matcher(string.trim()); if (!isNum.matches()) { return false; }//from w w w . ja v a2 s. c o m return true; }
From source file:Main.java
public static boolean isEmailAddress(String email) { Pattern pattern = Pattern .compile("^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"); // .compile("^/w+([-.]/w+)*@/w+([-]/w+)*/.(/w+([-]/w+)*/.)*[a-z]{2,3}$"); Matcher matcher = pattern.matcher(email); return matcher.matches(); }
From source file:Main.java
public static boolean checkNumber(String username) { Pattern pattern = Pattern.compile("^[0-9]+$"); Matcher matcher = pattern.matcher(username); return matcher.matches(); }
From source file:Main.java
public static boolean isCellphone(String str) { Pattern pattern = Pattern.compile("1[0-9]{10}"); Matcher matcher = pattern.matcher(str); if (matcher.matches()) { return true; } else {/* ww w . j a v a2s. c om*/ return false; } }
From source file:Main.java
public static boolean isNumeric(String str) { Pattern pattern = Pattern.compile("[0-9]*"); Matcher isNum = pattern.matcher(str); if (isNum.matches()) { return true; } else {/*from ww w .j a va2 s .c o m*/ return false; } }
From source file:Main.java
public static boolean passwordFormat(String password) { Pattern pattern = Pattern.compile("^[\\@A-Za-z0-9\\!\\#\\$\\%\\^\\&\\*\\.\\~]{6,30}$"); Matcher mc = pattern.matcher(password); return mc.matches(); }