Softwaretechnik-II/testing/AufgabeEmailMatcher/EmailMatcher.java

17 lines
408 B
Java
Raw Normal View History

2024-10-30 19:29:50 +01:00
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class EmailMatcher {
// Regex für Emailadressen
static String emailRegex = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$";
static Pattern pattern = Pattern.compile(emailRegex);
static boolean isValidEmail(String email) {
Matcher matcher = pattern.matcher(email);
return matcher.matches();
}
}