Here is the validation that we have to use for email validation.
Using posix syntax:
^[[:graph:]]\\+@[[:graph:]]\\+\\.[[:graph:]]\\+$
I have written sample program to validate, but i have failed to give right Email address to fulfill posix syntax regular expression. Could you please any one help me out to correct my below Java example.
Java Example:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegexMatches {
    public static void main(String args[]) {
      String email = "sudheer@gmail.com";
      String pattern ="^[[:graph:]]\\+@[[:graph:]]\\+\\.[[:graph:]]\\+$";
      //String pattern = ".+@.+\\.[a-z]+";// This is Working fine.
      if (!testRegex(email, pattern))
        System.out.println("Validator Exception");
      else
        System.out.println("Success");
    }
     public static boolean testRegex(String value, String regex) {
       Pattern pattern = Pattern.compile(regex);
       Matcher matcher = pattern.matcher(value);
       return matcher.matches();
    }
}
 
     
    