用于验证电子邮件地址格式的正则表达式。 [英] Regular Expression for Validate E-mail Address format.?

查看:103
本文介绍了用于验证电子邮件地址格式的正则表达式。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

验证电子邮件地址格式的正则表达式。

格式:< Local-Part> @< Domain>



最大长度不超过254个字符。

[本地部分为64]



本地部分的有效字符:

[a-z,A-Z,0-9]

! #$%& '* + - / =? ^ _` {| }〜

也允许U + 007F以上的国际字符。

具有以下限制的字符:

空格和(),:;<> @ [] \



限制条件:

·无允许在本地部分使用上述字符

以外的引号。



·引号()和反斜杠(\)可能仅在

引用字符串并且前面带有反斜杠时才存在。

有效Ex:VERY \\\。.unusual \\ \\\@ strange.example.com

无效的Ex:every\unusual\"@example.com



·带引号的字符串必须后跟点字符或引号

字符串应该是本地部分中唯一的元素。

有效Ex: abc@ gmail.com,abc.xy @ example.com

无效的例外:只是不是right@example.com

解决方案

%& '* + - / =? ^ _` {| }〜

也允许U + 007F以上的国际字符。

具有以下限制的字符:

空格和(),:;<> @ [] \



限制条件:

·无允许在本地部分使用上述字符

以外的引号。



·引号()和反斜杠(\)可能仅在

引用字符串并且前面带有反斜杠时才存在。

有效Ex:VERY \\\。.unusual \\ \\\@ strange.example.com

无效的Ex:every\unusual\"@example.com



·带引号的字符串必须后跟点字符或引号

字符串应该是本地部分中唯一的元素。

有效Ex: abc@ gmail.com,abc.xy @ example.com

无效的Ex:只是notright@example.com

[A-Z0-9!#

%& * + / = ^ _`{|}?!〜 - ] +(?: \ [A-Z0-9#

Regular Expression for Validate E-mail Address format.?
Format: <Local-Part>@<Domain>

Maximum length up to 254 characters.
[64 for Local-part]

Valid characters in Local-Part:
[a–z, A–Z, 0-9]
! # $ % & ' * + - / = ? ^ _ ` { | } ~
International characters above U+007F are also permitted.
Characters with following restrictions:
Space and "(),:;<>@[] \

Restrictions:
· None of the above characters in the local part is allowed
outside quotation marks.

· Quotes (") and backslashes (\) may only exist when within
quoted strings and preceded by a backslash.
Valid Ex: "VERY\\\".unusual\\"@strange.example.com
Invalid Ex: "very\unusual"@example.com

· Quoted strings must be followed by dot character or the quote
string should be the only element in the local-part.
Valid Ex: "abc"@gmail.com, "abc".xy@example.com
Invalid Ex: just"not"right@example.com

解决方案

% & ' * + - / = ? ^ _ ` { | } ~
International characters above U+007F are also permitted.
Characters with following restrictions:
Space and "(),:;<>@[] \

Restrictions:
· None of the above characters in the local part is allowed
outside quotation marks.

· Quotes (") and backslashes (\) may only exist when within
quoted strings and preceded by a backslash.
Valid Ex: "VERY\\\".unusual\\"@strange.example.com
Invalid Ex: "very\unusual"@example.com

· Quoted strings must be followed by dot character or the quote
string should be the only element in the local-part.
Valid Ex: "abc"@gmail.com, "abc".xy@example.com
Invalid Ex: just"not"right@example.com


[a-z0-9!#


%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#


这篇关于用于验证电子邮件地址格式的正则表达式。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆