package java0905_api; import java.util.regex.Pattern; /* * ìì´ë를 ì ë ¥í ë ì문ì,ì«ì ì¡°í©ì¼ë¡ í©ëë¤. * ìµì 5ìì´ì 10ìì´íê¹ì§ë§ ê°ë¥í©ëë¤. * (ë°ëì ì문ìë¡ ììíë¤.) * [ì¶ë ¥ê²°ê³¼] * ë¡ê·¸ì¸ ëììµëë¤. * íìì´ ìëëë¤. */ public class Java127_RegEx { public static void main(String[] args) { System.out.print("ymy232"); display(process("ymy232")); System.out.print("korea"); display(process("korea")); }// end main() public static boolean process(String sn) { // ì¬ê¸°ë¥¼ 구ííì¸ì. boolean res = sn.matches("[a-zA-Z][a-zA-Z0-9]{4,9}") && Pattern.compile("\\d").matcher(sn).find(); return res; }// end process() public static void display(boolean res) { if (res) { System.out.println(" ë¡ê·¸ì¸ì´ ëììµëë¤."); } else { System.out.println(" íìì´ ìëëë¤."); } }// end display() }// end class