Possible Duplicate:
What is the best regular expression for validating email addresses?
I am using the following regular expression to validate e-mail addresses:
^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$
It doesn't consider the following e-mail address valid: username@q.c开发者_开发知识库om, but according to our customer it is a valid e-mail.
How do I modify the following regular expression statement to accept username@q.com as a valid e-mail address?
Why do you need a regular expression to check the validity of an e-mailadres? If I would fill in fake@fake.com the regular expression would also say it is valid.
In my opinion, regular expressions take a lot of runtime to evaluate, and mostly do not make you accomplish your goal. Think about why you actually need it, and perhaps go for a simpler one that just checks if it is of the form #@#.# (#=some text) See: http://www.linuxjournal.com/article/9585
精彩评论