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.
Asked
Active
Viewed 98 times
-5
-
6First question, zero effort. Classic.. – Soner Gönül Jan 15 '14 at 09:21
-
possible duplicate of [Using a regular expression to validate an email address](http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address) – Kippie Jan 15 '14 at 09:22
-
Please read this stackoverflow.com/questions/how-to-ask as it stands this is a very low quality question – Liath Jan 15 '14 at 09:22
-
3Ignoring the fact that this question has been asked alot already, what kind of user experience forces a user to type an exact string "No Email" just to point out they don't have one? – Kippie Jan 15 '14 at 09:24
-
1@Kippie, indeed. Why not just leave it blank and state the field is optional. :) – Moo-Juice Jan 15 '14 at 09:25
2 Answers
0
You can combine your regex with an or expression |
var regex = "(.+@.+\..+|No Email)"
The validation part need some improvement (not RFC compliant) but you get the idea.

gunr2171
- 16,104
- 25
- 61
- 88

Jürgen Steinblock
- 30,746
- 24
- 119
- 189