views:

54

answers:

1

Hi I have created a schema and the following pattern to check for email id:

\w+([-+._]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*.

However it is not accepting email id's containing underscore like [email protected]. Can you please modify this pattern so that it accepts _ too.

Thanks

+1  A: 

Something like the following should work (I removed some other apparent errors or idiosyncrasies):

\w[-+._\w]+@\w[-.\w]+\.\w[-.\w]+

however, be aware that whatever pattern you choose, you'll always exclude some valid email-addresses (the email address standard is very wide) while at the same time you may be including some invalid ones.

Abel
Thanks it worked.
Mini
It would be nice if you accepted the answer after he bothered giving it!
xcut