Java中的电子邮件验证的正则表达式 [英] regular expression for email validation in Java
本文介绍了Java中的电子邮件验证的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下正则表达式
I am using the follwoing regular expression
(".+@.+\\.[a-z]+")
它接受#@#.com作为有效电子邮件。我应该使用的模式是什么?
Bit it accepts #@#.com as a valid email. What's the pattern I should use?
推荐答案
您应该使用apache-commons电子邮件验证程序。您可以从此处获取jar文件。
You should use apache-commons email validator. You can get the jar file from here.
下面是一个如何使用它的简单示例:
Here is a simple example of how to use it:
import org.apache.commons.validator.routines.EmailValidator;
boolean isValidEmail = EmailValidator.getInstance().isValid(emailAddress);
这篇关于Java中的电子邮件验证的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文