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 CheckUserName(String name) { Pattern p = Pattern.compile("[0-9]*"); Matcher m = p.matcher(name); if (m.matches()) { } p = Pattern.compile("[a-zA-Z]"); m = p.matcher(name); if (m.matches()) { } return true; } }