Check out example codes for "how to test for legit email in java". It will help you in understanding the concepts better.

Code Example 1

// Java program to check if an email address 
// is valid using Regex. 
import java.util.regex.Matcher; 
import java.util.regex.Pattern; 
  
class Test 
{ 
    public static boolean isValid(String email) 
    { 
        String emailRegex = "^[a-zA-Z0-9_+&*-]+(?:\\."+ 
                            "[a-zA-Z0-9_+&*-]+)*@" + 
                            "(?:[a-zA-Z0-9-]+\\.)+[a-z" + 
                            "A-Z]{2,7}$"; 
                              
        Pattern pat = Pattern.compile(emailRegex); 
        if (email == null) 
            return false; 
        return pat.matcher(email).matches(); 
    } 
  
    /* driver function to check */
    public static void main(String[] args) 
    { 
        String email = "[email protected]"; 
        if (isValid(email)) 
            System.out.print("Yes"); 
        else
            System.out.print("No"); 
    } 
}

Learn ReactJs, React Native from akashmittal.com