Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.regex.Matcher; import java.util.regex.Pattern; import android.text.TextUtils; public class Main { private static Pattern mauritianMobilePhoneNumber = Pattern.compile( "(\\+230|\\+230[ ]{1,3}|\\(\\+230\\)|\\(\\+230\\)[ ]{1,3})?(4|7|2|8|9)[0-9]{2}( |-)?[0-9]{2}( |-)?[0-9]{2}"); public static final boolean isMobilePhoneNumber(CharSequence target) { if (target != null || TextUtils.isEmpty(target) == false) { Matcher numberMatcher = mauritianMobilePhoneNumber.matcher(target); return numberMatcher.matches(); } return false; } }