且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP RegEx:在电子邮件验证模式中查找漏洞

更新时间:2023-02-20 08:42:17

使用正则表达式进行验证电子邮件很棘手

Using regular expression to validate emails is tricky

尝试以下电子邮件作为正则表达式的输入,即: ^ [\w .-] + @ [A-Za -z0-9 .-] + \。[A-Za-z] {2,6} $

Try the following email as an input to your regex ie:^[\w.-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$

abc @ b ... com

您可以在 http://www.regular-expressions.info/email.html

如果您是针对某个应用执行此操作,则可以通过向提供的地址发送电子邮件来使用电子邮件验证,而不要使用非常复杂的正则表达式。

If you are doing this for an app then use email validation by sending an email to the address provided rather than using very complex regex.