regular expression for email validation in Java

后端 未结 6 1156
渐次进展
渐次进展 2020-12-05 08:46

I am using the follwoing regular expression

(\".+@.+\\\\.[a-z]+\")

Bit it accepts #@#.com as a valid email. What\'s the pattern I should u

6条回答
  •  情书的邮戳
    2020-12-05 09:23

    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);
    

提交回复
热议问题