Conversations/src/eu/siacs/conversations/utils/Validator.java

15 lines
471 B
Java
Raw Normal View History

2014-02-28 12:46:01 -05:00
package eu.siacs.conversations.utils;
2014-01-28 13:21:54 -05:00
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Validator {
public static final Pattern VALID_JID =
2014-05-15 14:43:10 -04:00
Pattern.compile("\\b^[A-Z0-9._%+-]+@([A-Z0-9.-]+\\.)?\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}\\b$|^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);
2014-01-28 13:21:54 -05:00
public static boolean isValidJid(String jid) {
Matcher matcher = VALID_JID.matcher(jid);
return matcher.find();
}
}