Softwaretechnik-II/testing/AufgabeUserRegistration/EmailMatcher.java

16 lines
413 B
Java
Raw Normal View History

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