java中匹配邮箱的正则表达式

发布时间:2013-09-27 01:41:20
import java.lang.String; 
 
import java.util.regex.Pattern; ..
 
import java.util.regex.Matcher; 
 
private static void pattern(){
 
//电子邮件
 String check = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$";
 Pattern regex = Pattern.compile(check);
 Matcher matcher = regex.matcher("12241@qq.name");
 boolean isMatched = matcher.matches();
 System.out.println(isMatched);
}