From 52da0fe7c9c68d4545f068fb84efbf0854c37392 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 28 Jan 2014 19:21:54 +0100 Subject: account management --- src/de/gultsch/chat/utils/Validator.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/de/gultsch/chat/utils/Validator.java (limited to 'src/de/gultsch/chat/utils') diff --git a/src/de/gultsch/chat/utils/Validator.java b/src/de/gultsch/chat/utils/Validator.java new file mode 100644 index 00000000..a29ffa0a --- /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(); + } +} -- cgit v1.2.3