package shiti1013;
import java.util.Scanner;
public class 校验用户名 {
/**
* @param args
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String re= "[A-Za-z].{5,10}";
while(true){
String s = sc.nextLine();
if(s.matches(re)){
System.out.println("恭喜登陆成功");
break;
}else{
System.out.println("账号错误");
}
}
}
}
|
|