Java tutorial
//package com.java2s; import android.text.TextUtils; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isQQNumber(String qqNumber) { if (!TextUtils.isEmpty(qqNumber)) { Pattern pattern = Pattern.compile("\\d{4,12}$"); Matcher matcher = pattern.matcher(qqNumber); return matcher.find(); } return false; } }