String email = "pankaj.singh@yahoo.co.in";
Pattern p = Pattern
.compile("[a-z][a-z_.0-9]*@[a-z0-9]*[.]{0,1}[a-z0-9]{1,3}.[a-z]{2,3}$");
Matcher m = p.matcher(email);
boolean b = m.matches();
if (b == true) {
System.out.println("Valid Email ID");
} else {
System.out.println("InValid Email ID");
}
Thanks sir for this post it really helped me to validate email in my project
ReplyDeleteThank you very much Sir. You are champ.
ReplyDeleteEarlier, I was thinking that email validation is very very difficult but you make it so easy.
Thanks again and keep it up....
This comment has been removed by the author.
DeleteThis comment has been removed by the author.
Delete