Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isQQNumber(String qqNum) { if (qqNum != null) { Pattern p = Pattern.compile("^[1-9][0-9]{4,14}$"); Matcher m = p.matcher(qqNum); return m.matches(); } else { return false; } } }