Java tutorial
//package com.java2s; import java.util.regex.Pattern; public class Main { public static boolean checkPhone(String phone) { String regex = "(\\+\\d+)?(\\d{3,4}\\-?)?\\d{7,8}$"; return Pattern.matches(regex, phone); } }