//实现使用正则表达式来判断指定的字符串是否是合法的E-mail地址
String regex = ".+@.+(\\..{2,3})*\\..{2,3}";
String regex1 = "\\w+@\\w+(\\.\\w+)*\\.\\w+";
String regex3 = "\\w+@\\w+(\\.\\w{2,3})*\\.\\w{2,3}";
String s37 = "aaaa";
String s38 = "aaaa@";
String s39 = "aaaa@qqqq";
String s40 = "745196899@qq.com";
String s41 = "745196899@qq.com.cn";
if(s37.matches(regex)){
System.out.println(s37+"是合法的E-mail地址");
}
if(s38.matches(regex)){
System.out.println(s38+"是合法的E-mail地址");
}
if(s39.matches(regex)){
System.out.println(s39+"是合法的E-mail地址");
}
if(s40.matches(regex)){
System.out.println(s40+"是合法的E-mail地址");
}
if(s41.matches(regex)){
System.out.println(s41+"是合法的E-mail地址");
}