本文介绍了电子邮件地址正则表达的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我一直在使用此模式来验证电子邮件地址: ^([0-9a-z] +)([0-9a-z \.- _] +)@([0-9a-z \。-_] +)\。([0-9a-z] +) 但我已经最近发现用破折号的地址不会通过这个测试。 我觉得他们应该通过。 出了什么问题? - Floydian Slip(tm) - 从月球的黑暗面广播 ; Random Precision Productions(tm) 67 Union St.#2D,Winooski,Vt.05404-1948 USA 星期日,7-晚上8点 - 冠军101.3 FM,科尔切斯特; 102.1 FM,Randolph,Vt。 cc*@floydianslip.com - 目的:RandomPrec - www.floydianslip.comI''ve been using this pattern to verify email addresses:^([0-9a-z]+)([0-9a-z\.-_]+)@([0-9a-z\.-_]+)\.([0-9a-z]+)But I''ve recently discovered that addresses with a dash in them won''tpass this test.Seems to me they should pass.What''s wrong?--Floydian Slip(tm) - "Broadcasting from the dark side of the moon"Random Precision Productions(tm)67 Union St. #2D, Winooski, Vt. 05404-1948 USASundays, 7-8 pm - Champ 101.3 FM, Colchester; 102.1 FM, Randolph, Vt. cc*@floydianslip.com - AIM: RandomPrec - www.floydianslip.com推荐答案 [AZ] =从A到Z的所有字符,也许是\-可能有帮助吗? - 垃圾邮件:新闻组(at )cr ********* @ verisign-sux-klj.com 电子邮件:< 0110001100101110011000100111010101110010011 010110 11001010100000001100011011100100110000101111010011 011100 1100001011100100010111001100011011011110110 1101001 00000>[A-Z] = All characters from A to Z, maybe a \- might help ?--Spam:newsgroup(at)cr*********@verisign-sux-klj.comEMail:<0110001100101110011000100111010101110010011 01011011001010100000001100011011100100110000101111010011 01110011000010111001000101110011000110110111101101101001 00000> [AZ] =从A到Z的所有字符,也许是\-可能有帮助吗? [A-Z] = All characters from A to Z, maybe a \- might help ? Aaaahhhh。但破折号不需要逃脱,做到了吗?你是否建议在表达式的第一部分添加短划线?喜欢这个? ^([0-9a-z - ] +)([0-9a-z \。-_] +)@([0-9a-z \。-_] +)\。([0-9a-z] +) 当然,这会让某人用短划线开始他们的地址, 我不确定是否允许在真实的电子邮件地址中使用。 - Floydian Slip(tm) - "从月球的阴暗面广播 Random Precision Productions(tm) 67 Union St.#2D,Winooski,Vt.05404-1948 USA 星期日,晚上7-8点 - 冠军101.3 FM,科尔切斯特; 102.1 FM,Randolph,Vt。 cc*@floydianslip.com - 目的:RandomPrec - www.floydianslip.comAaaahhhh. But a dash doesn''t need to be escaped, do it? Are yousuggesting a add a dash to the first part of the expression? Like this?^([0-9a-z-]+)([0-9a-z\.-_]+)@([0-9a-z\.-_]+)\.([0-9a-z]+)Of course, that would allow someone to start their address with a dash,which I''m not certain is allowable in real email addresses.--Floydian Slip(tm) - "Broadcasting from the dark side of the moon"Random Precision Productions(tm)67 Union St. #2D, Winooski, Vt. 05404-1948 USASundays, 7-8 pm - Champ 101.3 FM, Colchester; 102.1 FM, Randolph, Vt. cc*@floydianslip.com - AIM: RandomPrec - www.floydianslip.com 不[0-9a-z \。-_]表示:0到9和a to z和dot to underscore? 试试[0-9a-z \ ._-] HTH - 我有垃圾邮件过滤器工作。 给我发邮件包括urkxvq (有或没有引号)主题行中的,或者你的邮件将被无情地丢弃。Doesn''t [0-9a-z\.-_] mean: 0 to 9 and a to z and dot to underscore?try [0-9a-z\._-]HTH--I have a spam filter working.To mail me include "urkxvq" (with or without the quotes)in the subject line, or your mail will be ruthlessly discarded. 这篇关于电子邮件地址正则表达的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 阿里云证书,YYDS!
05-24 01:31