/** * 驗證手機號碼 * * @param mobiles * @return */ public static boolean isMobileNO(String mobiles) { boolean isValid = false; CharSequence inputStr = mobiles; // 正則表達式 String phone = "^1[34578]\\d{9}$"; Pattern pattern = Pattern.compile(phone); Matcher matcher = pattern.matcher(inputStr); if (matcher.matches()) { isValid = true; } return isValid; }