Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean PhoneValidate(String inputPhone) { String regExp = "^[1]([3][0-9]{1}|50|51|52|53|55|56|57|58|59|47|70|80|81|82|83|84|85|86|87|88|89|85|86)[0-9]{8}$"; return match(regExp, inputPhone); } private static boolean match(String regex, String str) { Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(str); return matcher.matches(); } }