|
|
@ -1,8 +1,11 @@ |
|
|
|
package hs.fulda.de.ci.exam.project; |
|
|
|
|
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
public class SmsNotification extends Notification { |
|
|
|
String to; |
|
|
|
String content; |
|
|
|
|
|
|
|
public SmsNotification(String to, String content) { |
|
|
|
super(); |
|
|
|
this.to = to; |
|
|
@ -20,6 +23,15 @@ public class SmsNotification extends Notification { |
|
|
|
} |
|
|
|
|
|
|
|
private boolean isValidEmail(String to) { |
|
|
|
return true; |
|
|
|
String regexPattern = "(\\(?([\\d \\-\\)\\–\\+\\/\\(]+){6,}\\)?([ .\\-–\\/]?)([\\d]+))"; |
|
|
|
return patternMatches(to, regexPattern); |
|
|
|
} |
|
|
|
|
|
|
|
public static boolean patternMatches(String emailAddress, String regexPattern) { |
|
|
|
return Pattern.compile(regexPattern) |
|
|
|
.matcher(emailAddress) |
|
|
|
.matches(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |