Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isValid_bec_kdh(String kdh) { Pattern p = Pattern.compile("^CN\\d{3}"); Matcher m = p.matcher(kdh); return m.matches(); } }