{"id":51987,"date":"2023-05-29T14:09:54","date_gmt":"2023-05-29T06:09:54","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=51987"},"modified":"2023-05-29T14:09:54","modified_gmt":"2023-05-29T06:09:54","slug":"regular-expression-emailregex","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/regular-expression-emailregex.html","title":{"rendered":"\u804a\u4e00\u804a \u5404\u79cd\u9a8c\u8bc1\u90ae\u4ef6\u5730\u5740\u7684\u6b63\u5219\u8868\u8fbe\u5f0f"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\u90ae\u4ef6\u5730\u5740\u4f3c\u4e4e\u662f\u4e00\u4ef6\u7b80\u5355\u7684\u4e8b\u60c5\uff0c\u4f46\u662f\u5982\u679c\u8981\u5b8c\u7f8e\u7684\u9a8c\u8bc1\u4e00\u4e2a\u5408\u89c4\u7684\u90ae\u4ef6\u5730\u5740\uff0c\u5176\u5b9e\u4e5f\u8bb8\u5f88\u590d\u6742\u3002\u90ae\u4ef6\u5730\u5740\u7684\u89c4\u8303\u6765\u81ea\u4e8e RFC 5322\u00a0\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

 <\/p>\n

\"\"<\/a>\u90ae\u4ef6\u5730\u5740\u7684\u89c4\u8303\u6765\u81ea\u4e8e RFC 5322\u00a0\u3002\u6709\u4e00\u4e2a\u7f51\u7ad9 emailregex.com\u00a0\u4e13\u95e8\u5217\u51fa\u5404\u79cd\u7f16\u7a0b\u8bed\u8a00\u4e0b\u7684\u9a8c\u8bc1\u90ae\u4ef6\u5730\u5740\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u5176\u4e2d\u5f88\u591a\u6b63\u5219\u8868\u8fbe\u5f0f\u90fd\u662f\u6211\u542c\u8bf4\u8fc7\u800c\u4ece\u672a\u89c1\u8fc7\u7684\u590d\u6742\u2014\u2014\u6211\u60f3\u8bf4\uff0c\u505a\u8fd9\u4e2a\u7f51\u7ad9\u7684\u7a0b\u5e8f\u5458\u662f\u88ab\u90ae\u4ef6\u9a8c\u8bc1\u8fd9\u4ef6\u4e8b\u4f24\u5bb3\u4e86\u591a\u6df1\u554a\uff01<\/p>\n

\u5176\u5b9e\uff0c\u5728\u4ea7\u54c1\u73af\u5883\u4e2d\uff0c\u4e00\u822c\u6765\u8bf4\u5e76\u4e0d\u9700\u8981\u8fd9\u4e48\u590d\u6742\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u505a\u523099.99%\u6b63\u786e\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u4ece\u6267\u884c\u6548\u7387\u548c\u6d4b\u8bd5\u8986\u76d6\u7387\u6765\u8bf4\uff0c\u53ea\u9700\u8981\u4e00\u4e2a\u7b80\u5355\u7684\u7248\u672c\u5373\u53ef\uff1a<\/p>\n

\/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\/.[A-Z]{2,4}$\/i<\/pre>\n

\u90a3\u4e48\u4e0b\u9762\u6211\u4eec\u6765\u770b\u770b\u8fd9\u4e9b\u66f4\u4e25\u8c28\u3001\u66f4\u590d\u6742\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5427\uff1a<\/p>\n

\u9a8c\u8bc1\u90ae\u4ef6\u5730\u5740\u7684\u901a\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\uff08\u7b26\u5408 RFC 5322 \u6807\u51c6\uff09<\/strong><\/div>\n
(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\/.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|\"(?:[\/x01-\/x08\/x0b\/x0c\/x0e-\/x1f\/x21\/x23-\/x5b\/x5d-\/x7f]|\/\/[\/x01-\/x09\/x0b\/x0c\/x0e-\/x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\/.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\/[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\/x01-\/x08\/x0b\/x0c\/x0e-\/x1f\/x21-\/x5a\/x53-\/x7f]|\/\/[\/x01-\/x09\/x0b\/x0c\/x0e-\/x7f])+)\/])<\/pre>\n

\u7531\u4e8e\u5404\u79cd\u8bed\u8a00\u5bf9\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u652f\u6301\u4e0d\u540c\u3001\u8bed\u6cd5\u5dee\u5f02\u548c\u8986\u76d6\u7387\u4e0d\u540c\uff0c\u6240\u4ee5\uff0c\u4e0d\u540c\u8bed\u8a00\u91cc\u9762\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u4e5f\u4e0d\u540c\uff1a<\/p>\n

Python<\/strong><\/div>\n

\u8fd9\u4e2a\u662f\u4e2a\u7b80\u5355\u7684\u7248\u672c\uff1a<\/p>\n

r\"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\/.[a-zA-Z0-9-.]+$)\"<\/pre>\n
Javascript<\/strong><\/div>\n

\u8fd9\u4e2a\u6709\u70b9\u590d\u6742\u4e86\uff1a<\/p>\n

\/^[-a-z0-9~!$%^&*_=+}{\/'?]+(\/.[-a-z0-9~!$%^&*_=+}{\/'?]+)*@([a-z0-9_][-a-z0-9_]*(\/.[-a-z0-9_]+)*\/.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\/.[0-9]{1,3}\/.[0-9]{1,3}\/.[0-9]{1,3}))(:[0-9]{1,5})?$\/i<\/pre>\n
Swift<\/strong><\/div>\n
[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\/\/.[A-Za-z]{2,6}<\/pre>\n
PHP<\/strong><\/div>\n

PHP \u7684\u8fd9\u4e2a\u7248\u672c\u5c31\u66f4\u590d\u6742\u4e86\uff0c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1-9]?[0-9]))(?:\/.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\/]))$\/iD<\/pre>\n
Perl \/ Ruby<\/strong><\/div>\n

\u5bf9\u4e0e PHP \u7684\u7248\u672c\uff0cPerl \u548c Ruby \u8868\u793a\u4e0d\u670d\uff0c\u53ef\u4ee5\u66f4\u4e25\u8c28\uff1a<\/p>\n

(?:(?:\/r\/n)?[ \/t])*(?:(?:(?:[^()<>@,;:\/\/\".\/[\/] \/000-\/031]+(?:(?:(?:\/r\/n)?[ \/t])+|\/Z|(?=[\/[\"()<>@,;:\/\/\".\/[\/]]))|\"(?:[^\/\"\/r\/\/]|\/\/.|(?:(?:\/r\/n)?[ \/t]))*\"(?:(?:\/r\/n)?[ \/t])*)(?:\/.(?:(?:\/r\/n)?[ \/t])*(?:[^()<>@,;:\/\/\".\/[\/] \/000-\/031]+(?:(?:(?:\/r\/n)?[ \/t])+|\/Z|(?=[\/[\"()<>@,;:\/\/\".\/[\/]]))|\"(?:[^\/\"\/r\/\/]|\/\/.|(?:(?:\/r\/n)?[\/t]))*\"(?:(?:\/r\/n)?[ \/t])*))*@(?:(?:\/r\/n)?[ \/t])*(?:[^()<>@,;:\/\/\".\/[\/] \/000-\/031]+(?:(?:(?:\/r\/n)?[ \/t])+|\/Z|(?=[\/[\"()<>@,;:\/\/\".\/[\/]]))|\/[([^\/[\/]\/r\/\/]|\/\/.)*\/](?:(?:\/r\/n)?[ \/t])*)(?:\/.(?:(?:\/r\/n)?[ \/t])*(?:[^()<>@,;:\/\/\".\/[\/] \/000-\/031]+(?:(?:(?:\/r\/n)?[ \/t])+|\/Z|(?=[\/[\"()<>@,;:\/\/\".\/[\/]]))|\/[([^\/[\/]\/r\/\/]|\/\/.)*\/](?:(?:\/r\/n)?[ \/t])*))*|(?:[^()<>@,;:\/\/\".\/[\/] \/000-\/031]+(?:(?:(?:\/r\/n)?[ \/t])+|\/Z|(?=[\/[\"()<>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\/n)?[ \/t])*)(?:\/.(?:(?:\/r\/n)?[ \/t])*(?:[^()<>@,;:\/\/\".\/[\/] \/000-\/031]+(?:(?:(?:\/r\/n)?[ \/t])+|\/Z|(?=[\/[\"()<>@,;:\/\/\".\/[\/]]))|\/[([^\/[\/]\/r\/\/]|\/\/.)*\/](?:(?:\/r\/n)?[ \/t])*))*\/>(?:(?:\/r\/n)?[ \/t])*))*)?;\/s<\/pre>\n
Perl 5.10 \u53ca\u4ee5\u540e\u7248\u672c<\/strong><\/div>\n

\u4e0a\u9762\u7684\u7248\u672c\uff0c\u55ef\uff0c\u6211\u53ef\u4ee5\u8bf4\u662f\u5929\u4e66\u5417\uff1f\u53cd\u6b63\u6211\u662f\u6ca1\u6709\u89e3\u8bfb\u7684\u60f3\u6cd5\u4e86\u3002\u5f53\u7136\uff0c\u65b0\u7248\u672c\u7684 Perl \u8bed\u8a00\u8fd8\u6709\u4e00\u4e2a\u66f4\u6613\u8bfb\u7684\u7248\u672c\uff08\u4f60\u662f\u8bf4\u771f\u7684\u4e48\uff1f\uff09<\/p>\n

\/(?(DEFINE)\r\n(?<address> (?&mailbox) | (?&group))\r\n(?<mailbox> (?&name_addr) | (?&addr_spec))\r\n(?<name_addr> (?&display_name)? (?&angle_addr))\r\n(?<angle_addr> (?&CFWS)? < (?&addr_spec) > (?&CFWS)?)\r\n(?<group> (?&display_name) : (?:(?&mailbox_list) | (?&CFWS))? ;\r\n(?&CFWS)?)\r\n(?<display_name> (?&phrase))\r\n(?<mailbox_list> (?&mailbox) (?: , (?&mailbox))*)\r\n\r\n(?<addr_spec> (?&local_part) \/@ (?&domain))\r\n(?<local_part> (?&dot_atom) | (?&quoted_string))\r\n(?<domain> (?&dot_atom) | (?&domain_literal))\r\n(?<domain_literal> (?&CFWS)? \/[ (?: (?&FWS)? (?&dcontent))* (?&FWS)?\r\n\/] (?&CFWS)?)\r\n(?<dcontent> (?&dtext) | (?&quoted_pair))\r\n(?<dtext> (?&NO_WS_CTL) | [\/x21-\/x5a\/x5e-\/x7e])\r\n\r\n(?<atext> (?&ALPHA) | (?&DIGIT) | [!#\/$%&'*+-\/=?^_`{|}~])\r\n(?<atom> (?&CFWS)? (?&atext)+ (?&CFWS)?)\r\n(?<dot_atom> (?&CFWS)? (?&dot_atom_text) (?&CFWS)?)\r\n(?<dot_atom_text> (?&atext)+ (?: \/. (?&atext)+)*)\r\n\r\n(?<text> [\/x01-\/x09\/x0b\/x0c\/x0e-\/x7f])\r\n(?<quoted_pair> \/\/ (?&text))\r\n\r\n(?<qtext> (?&NO_WS_CTL) | [\/x21\/x23-\/x5b\/x5d-\/x7e])\r\n(?<qcontent> (?&qtext) | (?&quoted_pair))\r\n(?<quoted_string> (?&CFWS)? (?&DQUOTE) (?:(?&FWS)? (?&qcontent))*\r\n(?&FWS)? (?&DQUOTE) (?&CFWS)?)\r\n\r\n(?<word> (?&atom) | (?&quoted_string))\r\n(?<phrase> (?&word)+)\r\n\r\n# Folding white space\r\n(?<FWS> (?: (?&WSP)* (?&CRLF))? (?&WSP)+)\r\n(?<ctext> (?&NO_WS_CTL) | [\/x21-\/x27\/x2a-\/x5b\/x5d-\/x7e])\r\n(?<ccontent> (?&ctext) | (?&quoted_pair) | (?&comment))\r\n(?<comment> \/( (?: (?&FWS)? (?&ccontent))* (?&FWS)? \/) )\r\n(?<CFWS> (?: (?&FWS)? (?&comment))*\r\n(?: (?:(?&FWS)? (?&comment)) | (?&FWS)))\r\n\r\n# No whitespace control\r\n(?<NO_WS_CTL> [\/x01-\/x08\/x0b\/x0c\/x0e-\/x1f\/x7f])\r\n\r\n(?<ALPHA> [A-Za-z])\r\n(?<DIGIT> [0-9])\r\n(?<CRLF> \/x0d \/x0a)\r\n(?<DQUOTE> \")\r\n(?<WSP> [\/x20\/x09])\r\n)\r\n\r\n(?&address)\/x<\/pre>\n
Ruby (\u7b80\u5355\u7248)<\/strong><\/div>\n

Ruby \u8868\u793a\uff0c\u5176\u5b9e\u4eba\u5bb6\u8fd8\u6709\u4e2a\u7b80\u5355\u7248\u672c\uff1a<\/p>\n

\/\/A([\/w+\/-].?)+@[a-z\/d\/-]+(\/.[a-z]+)*\/.[a-z]+\/z\/i<\/pre>\n
.NET<\/strong><\/div>\n

\u8fd9\u6837\u7684\u7248\u672c\u8c01\u6ca1\u6709\u554a\u2014\u2014.NET \u8bf4\uff1a<\/p>\n

^\/w+([-+.']\/w+)*@\/w+([-.]\/w+)*\/.\/w+([-.]\/w+)*$<\/pre>\n
grep \u547d\u4ee4<\/strong><\/div>\n

\u7528 grep \u547d\u4ee4\u5728\u6587\u4ef6\u4e2d\u67e5\u627e\u90ae\u4ef6\u5730\u5740\uff0c\u6211\u60f3\u4f60\u4e0d\u4f1a\u5199\u4e2a\u82e5\u5e72\u884c\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5427\uff0c\u610f\u601d\u4e00\u4e0b\u5c31\u884c\u4e86\uff1a<\/p>\n

$ grep -E -o \"\/b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\/.[A-Za-z]{2,6}\/b\" filename.txt<\/pre>\n
SQL Server<\/strong><\/div>\n

\u5728 SQL Server \u4e2d\u4e5f\u662f\u53ef\u4ee5\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\uff0c\u4e0d\u8fc7\u8fd9\u4e2a\u4ee3\u7801\u7247\u6bb5\u5e94\u8be5\u662f\u6765\u81ea\u67d0\u4e2a\u4ea7\u54c1\u73af\u5883\u4e2d\u7684\uff0c\u6240\u4ee5\uff0c\u8fd8\u4f53\u8d34\u7684\u7167\u987e\u4e86\u90a3\u4e9b\u628a\u90ae\u4ef6\u5730\u5740\u5199\u9519\u7684\u4eba\uff1a<\/p>\n

 select email \r\n from table_name where \r\n patindex ('%[ &'',\":;!+=\/\/()<>]%', email) > 0 -- Invalid characters\r\n or patindex ('[@.-_]%', email) > 0 -- Valid but cannot be starting character\r\n or patindex ('%[@.-_]', email) > 0 -- Valid but cannot be ending character\r\n or email not like '%@%.%' -- Must contain at least one @ and one .\r\n or email like '%..%' -- Cannot have two periods in a row\r\n or email like '%@%@%' -- Cannot have two @ anywhere\r\n or email like '%.@%' or email like '%@.%' -- Cannot have @ and . next to each other\r\n or email like '%.cm' or email like '%.co' -- Camaroon or Colombia? Typos. \r\n or email like '%.or' or email like '%.ne' -- Missing last letter<\/pre>\n
Oracle PL\/SQL<\/strong><\/div>\n

\u8fd9\u4e2a\u662f\u4e0d\u662f\u6709\u70b9\u5077\u61d2\uff1f\u5c24\u5176\u662f\u5728\u90a3\u4e9b\u201c\u590d\u6742\u201d\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u4e4b\u540e\uff1a<\/p>\n

SELECT email \r\nFROM table_name\r\nWHERE REGEXP_LIKE (email, '[A-Z0-9._%-]+@[A-Z0-9._%-]+\/.[A-Z]{2,4}');<\/pre>\n
MySQL<\/strong><\/div>\n

\u597d\u5427\uff0c\u770b\u6765\u6700\u540e\u4e5f\u4e00\u6837\u61d2\uff1a<\/p>\n

SELECT * FROM `users` WHERE `email` NOT REGEXP '^[A-Z0-9._%-]+@[A-Z0-9.-]+\/.[A-Z]{2,4}$';<\/pre>\n

\u90a3\u4e48\uff0c\u4f60\u6709\u6ca1\u6709\u5173\u4e8e\u9a8c\u8bc1\u90ae\u4ef6\u5730\u5740\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5206\u4eab\u7ed9\u5927\u5bb6\uff1f<\/p>\n

 <\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-5963-1.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/regular-expression-emailregex.html<\/a>\u7f16\u8f91\u5458\uff1a\u5f20\u96c4\uff0c\u5ba1\u6838\u5458\uff1a\u6768\u9e4f\u98de<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\u90ae\u4ef6\u5730\u5740\u4f3c\u4e4e\u662f\u4e00\u4ef6\u7b80\u5355\u7684\u4e8b\u60c5\uff0c\u4f46\u662f\u5982\u679c\u8981\u5b8c\u7f8e\u7684\u9a8c\u8bc1\u4e00\u4e2a\u5408\u89c4\u7684\u90ae\u4ef6\u5730\u5740\uff0c\u5176\u5b9e\u4e5f\u8bb8\u5f88\u590d\u6742\u3002<\/p>\n","protected":false},"author":643,"featured_media":52066,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-51987","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/51987","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/643"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=51987"}],"version-history":[{"count":11,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/51987\/revisions"}],"predecessor-version":[{"id":273619,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/51987\/revisions\/273619"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/52066"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=51987"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=51987"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=51987"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}