Please read the requirement before thinking it is duplicate of any similar question.
As far as I found more than 20 Email validation regular expressions But all of them allows
a@a.co.in.in.in.in.in.in.in
as valid email address!!!
I want to restrict that only two dots(.) should be allowed.
For Example:
Valid Emails
somename@yahoo.in
somename@yahoo.co.in
somename@somesite.bizz
somename@gmail.com
somename@somesite.net
Invalid Emails
@.co
@a.com
a@a
a@.com
a@a.co.in.in //maximum two dots allowed otherwise invalid
a@a.co.in.in.in.in.in.in //maximum two dots allowed otherwise invalid
For this I tried with
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9]+\.[a-zA-Z]{2,5}[\.[a-zA-Z]{2,5}]{0,1}
It is working with 2 dots but throwing invalid message for
somename@somesite.com