Regular expressions are a powerful tool for validating, parsing, and manipulating strings, with Pattern and Matcher classes providing the core functionality.
Source Code
Pattern pattern = Pattern.compile("^(.+)@(.+)$");
Matcher matcher = pattern.matcher("[email protected]");
if (matcher.matches()) {
System.out.println("Email is valid");
} else {
System.out.println("Email is not valid");
}