Underscore not accepting in xml schema for email address

纵然是瞬间 提交于 2020-01-06 18:07:25

问题


Hi I have created a schema and the following pattern to check for email id:

\w+([-+._]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*.

However it is not accepting email id's containing underscore like bob_t@example.com. Can you please modify this pattern so that it accepts _ too.

Thanks


回答1:


Something like the following should work (I removed some other apparent errors or idiosyncrasies):

\w[-+._\w]+@\w[-.\w]+\.\w[-.\w]+

however, be aware that whatever pattern you choose, you'll always exclude some valid email-addresses (the email address standard is very wide) while at the same time you may be including some invalid ones.



来源:https://stackoverflow.com/questions/2973052/underscore-not-accepting-in-xml-schema-for-email-address

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!