Tuesday, June 12, 2012

Email Check Using Java Regex


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");
}

4 comments:

  1. Thanks sir for this post it really helped me to validate email in my project

    ReplyDelete
  2. Thank you very much Sir. You are champ.
    Earlier, I was thinking that email validation is very very difficult but you make it so easy.
    Thanks again and keep it up....

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. This comment has been removed by the author.

      Delete

Spring Boot Config Server and Config Client.

 In Spring cloud config we can externalise our configuration files to some repository like GIT HUT, Amazon S3 etc. Benefit of externalising ...