Regular expression for email and 'No Email'

Need regular expression to validate email address also if user don't have email, user able to type 'No Email'. such that regular expression should validate 'No Email' as a valid string.


 @"^(([w.-]+)@([w-]+)((.(w){2,3})+)|(No Email))$"

You can combine your regex with an or expression |

var regex = "(.+@.+..+|No Email)"

http://refiddle.com/h2x

The validation part need some improvement (not RFC compliant) but you get the idea.

链接地址: http://www.djcxy.com/p/92642.html

上一篇: 如何使用正则表达式匹配特定域的所有电子邮件地址?

下一篇: 电子邮件和“无电子邮件”的正则表达式