Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static Boolean validPhone(String phone) { String regex = "^1[3-8]{1}[0-9]{9}$"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(phone); return matcher.matches(); } }