regular expression for email validation in Java

后端 未结 6 1135
渐次进展
渐次进展 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:45

    Here's a web page that explains that better than I can: http://www.regular-expressions.info/email.html (EDIT: that appears to be a bit out of date since it refers to RFC 2822, which has been superseded by RFC 5322)

    And another with an interesting take on the problem of validation: http://www.markussipila.info/pub/emailvalidator.php

    Generally the best strategy for validating an email address is to just try sending mail to it.

提交回复
热议问题