允许(+)登录电子邮件验证 [英] Allow (+) sign in email validation
本文介绍了允许(+)登录电子邮件验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用正则表达式来验证电子邮件。
/^([\w-]+(?:。[\\\-] + ))@((?:[\w - ] +)\w [\w - ] {0,66})([AZ] {2,6-}(:[AZ] {2。?。 })(\。+ \)?)$ / i
所以我想允许+号只允许其他特殊字符。
我需要在这种模式下做出什么改变?
谢谢Anubhav
I am using the regular expression to validate emails.
/^([\w-]+(?:.[\w-]+))@((?:[\w-]+.)\w[\w-]{0,66}).([a-z]{2,6}(?:.[a-z]{2})(\".+\")?)$/i
So i want to allow the + sign only other special characters are not allowed.
What change I need to make in this pattern?
Thanks Anubhav
推荐答案
/ i
所以我想允许+号只允许其他特殊字符。
我需要在这个模式中做出什么改变?
谢谢Anubhav
/i
So i want to allow the + sign only other special characters are not allowed.
What change I need to make in this pattern?
Thanks Anubhav
I不知道你想要实现什么以及为什么,但是'+'是正则表达式语法的一部分,所以我能看到的唯一可能的问题是知道你可以转义任何字符,在这种情况下,'\ + 。我没有在你的Regex示例中看到这两个字符的组合,这让我觉得这是你的问题。
-SA
I don't know what do you want to achieve and why, but '+' is a part of Regular Expression syntax, so the only possible problem I can see is knowing that you can escape any character, in this case, '\+'. I did not see this combination of two characters in your Regex sample, that makes me think that this is your problem.
—SA
http://msdn.microsoft .com / zh-cn / library / 01escwtf(v = vs.110).aspx [ ^ ]
这篇关于允许(+)登录电子邮件验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文