I have a requirement of validating email field. Most of the things are done. But I'm stuck at one place. The email allows _, +, . only once in the username part (i.e. before @), once or more, but never consecutively. Also, . can't be immediately before or after @. I couldn't do that checking for consecutive dots or pluses. How to add with \\w a dot or a plus? Can somebody kindly help? Thanks in advance.
Ping & DNS - updated with new look and Ping home screen widget
Joined: Sep 02, 2008
Thanks for the reply Ulf, but I'm not sure how much EmailValidator class will help when one needs a custom validator (like in my case + allowed, but ... not allowed, though the 2nd one is a perfectly valid email IMO). Anyway, just after posting here I got the solution myself:
The () in place of  did the trick actually.
Joined: Mar 22, 2005
It's generally not a good idea to fail email validation for valid addresses. If an address is good enough for the relevant RFCs, then it should be good enough for you application. Also note that the regexp will fail I18N domain names.