aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/utils/Validator.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/utils/Validator.java')
-rw-r--r--src/eu/siacs/conversations/utils/Validator.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/utils/Validator.java b/src/eu/siacs/conversations/utils/Validator.java
new file mode 100644
index 00000000..fce953ae
--- /dev/null
+++ b/src/eu/siacs/conversations/utils/Validator.java
@@ -0,0 +1,14 @@
+package eu.siacs.conversations.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();
+ }
+}