判断邮箱,邮箱的正则表达式

it2022-05-05  132

邮箱的正则表达式判断了

1 public class EmailUtil { 2 public static boolean isEmail(String email) { 3 String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$"; 4 Pattern p = Pattern.compile(str); 5 Matcher m = p.matcher(email); 6 7 return m.matches(); 8 } 9 }

 

直接使用就ok了

转载于:https://www.cnblogs.com/wangying222/p/5783989.html

相关资源:Android 非空格式验证框架的使用,验证邮箱,非空,2选1等等

最新回复(0)