aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/utils/Validator.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-01-28 19:21:54 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-01-28 19:21:54 +0100
commit52da0fe7c9c68d4545f068fb84efbf0854c37392 (patch)
tree4c6bfae86fc90274b26e0c18ebd7793040663759 /src/de/gultsch/chat/utils/Validator.java
parent4f902d8210d50a586c7ece1bb7da2ab26fd18da5 (diff)
account management
Diffstat (limited to 'src/de/gultsch/chat/utils/Validator.java')
-rw-r--r--src/de/gultsch/chat/utils/Validator.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/de/gultsch/chat/utils/Validator.java b/src/de/gultsch/chat/utils/Validator.java
new file mode 100644
index 000000000..a29ffa0ae
--- /dev/null
+++ b/src/de/gultsch/chat/utils/Validator.java
@@ -0,0 +1,14 @@
+package de.gultsch.chat.utils;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class Validator {
+ public static final Pattern VALID_JID =
+ Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);
+
+ public static boolean isValidJid(String jid) {
+ Matcher matcher = VALID_JID.matcher(jid);
+ return matcher.find();
+ }
+}