Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static final String ACC_REGULAR = "^[a-zA-Z][a-zA-Z0-9_]{5,19}$"; public static boolean isDandelionNo(String dandelionNo) { Pattern p = Pattern.compile(ACC_REGULAR); Matcher m = p.matcher(dandelionNo); return m.matches(); } }