Android examples for java.util.regex:Phone Number Pattern
Checks if a string contains a valid SMS number using regex.
//package com.java2s; public class Main { /**/*from w w w .j a v a2 s. com*/ * Checks if a string contains a valid SMS number. * * @param number String to validate * @return <code>true</code> if valid, otherwise <code>false</code>. */ public static boolean isValidSMSnumber(String number) { return number.matches("\\d{7,10}"); } }