简体   繁体   English

与<...>的模式匹配电子邮件地址

[英]Pattern Matching Email Address with <…>

how is a pattern defined to check whether it's a valid Email-address with optional arrows like <example.com> which shouldn't be necessary. 如何定义一种模式来检查它是否是有效的电子邮件地址,该电子邮件地址带有诸如<example.com>类的可选箭头,因此不必要。 And if the Email-address begins with < but doesn't end with the enclosing > it should be ignored as well as < .... >> etc.. 并且,如果电子邮件地址以<开头但不以包围的>结尾,则应将其以及< .... >>等都忽略掉。

Can anybody help me? 有谁能够帮助我?

The pattern for an Email-address is 电子邮件地址的模式是

^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$;

试试这个正则表达式:

^[a-zA-Z0-9_!#$%&’*+/=?`{|}~^-]+(?:\\.[a-zA-Z0-9_!#$%&’*+/=?`{|}~^-]+)*@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM