Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
下面的正则表达式不允许带有下划线的电子邮件 ID,例如 myName_6@a.com
@"^([0-9a-zA-Z]([-.w]*[0-9a-zA-Z_])*@([0-9a-zA-Z][-w]*[0-9a-zA-Z].)+[a-zA-Z]{2,9})$"
任何的想法?
正则表达式中的任何地方都没有下划线,这说明它与下划线不匹配。尝试在 - 符号左侧的允许字符列表中添加下划线@。
@
试试这个
/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/