Java examples for java.util.regex:Match Phone Number
is Telephone Number by Regex
//package com.java2s; import java.util.regex.Pattern; public class Main { private static Pattern PATTERN_TEL = Pattern .compile("^([0-9]{3,4}-)?[0-9]{7,8}$"); public static boolean isTelephone(String telephone) { if (telephone == null) return false; else/* w w w . j a v a2 s. c om*/ return PATTERN_TEL.matcher(telephone).matches(); } }