|
|
@ -1,5 +1,7 @@ |
|
|
|
package hs.fulda.de.ci.exam.project; |
|
|
|
|
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
public class EmailNotification extends Notification { |
|
|
|
String email; |
|
|
|
String content; |
|
|
@ -19,6 +21,14 @@ public class EmailNotification extends Notification { |
|
|
|
} |
|
|
|
|
|
|
|
private boolean isValidEmail(String email) { |
|
|
|
return true; |
|
|
|
String regexPattern = "^(?=.{1,64}@)[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*@" |
|
|
|
+ "[^-][A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$"; |
|
|
|
return patternMatches(email, regexPattern); |
|
|
|
} |
|
|
|
|
|
|
|
public static boolean patternMatches(String emailAddress, String regexPattern) { |
|
|
|
return Pattern.compile(regexPattern) |
|
|
|
.matcher(emailAddress) |
|
|
|
.matches(); |
|
|
|
} |
|
|
|
} |