String qq = "12354687912345";
String regex = "[1-9][0-9]{4,14}";// 首位不为0的数字,总长度5-15之间
boolean result = qq.matches(regex);
System.out.println("result " + result);
public static void main(String[] args) {
// 获取下列字符串中的3个字符组成的字符串,并输出
// "wo jin tian bu xiang shang ke, but bi xu shang, you can dai ti wo yi
// xia bu?"
String s = "wo jin tian bu xiang shang ke, but bi xu shang, you can dai ti wo yi xia bu?";
String regex = "\\b\\w{3}\\b";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(s);
while (m.find()) {
System.out.println(m.group());
}