RegexValidator implements Serializable { public boolean isValid(String value) { if (value == null) { return false; } for (Pattern pattern : patterns) { if (pattern.matcher(value).matches()) { return true; } } return false; } RegexValidator(String regex);  RegexValidator(String regex, boolean caseSensitive);  RegexValidator(String[] regexs);  RegexValidator(String[] regexs, boolean caseSensitive); boolean isValid(String value); String[] match(String value); String validate(String value); @Override String toString();  }
@Test public void testisValid() { RegexValidator regexValid = new RegexValidator(DOMAIN_LABEL_REGEX); String email = "ab.c@sina.com"; assertFalse(regexValid.isValid(email)); String email2 = "ab.c@yahoo.com"; assertFalse(regexValid.isValid(email2)); }