You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

EmailValidator.java 924B

1234567891011121314151617181920212223242526272829303132
  1. package com.vaadin.data.validator;
  2. /**
  3. * String validator for e-mail addresses. The e-mail address syntax is not
  4. * complete according to RFC 822 but handles the vast majority of valid e-mail
  5. * addresses correctly.
  6. *
  7. * See {@link com.vaadin.data.validator.AbstractStringValidator} for
  8. * more information.
  9. *
  10. * @author IT Mill Ltd.
  11. * @version
  12. * @VERSION@
  13. * @since 5.4
  14. */
  15. @SuppressWarnings("serial")
  16. public class EmailValidator extends RegexpValidator {
  17. /**
  18. * Creates a validator for checking that a string is a syntactically valid
  19. * e-mail address.
  20. *
  21. * @param errorMessage
  22. * the message to display in case the value does not validate.
  23. */
  24. public EmailValidator(String errorMessage) {
  25. super(
  26. "^([a-zA-Z0-9_\\.\\-+])+@(([a-zA-Z0-9-])+\\.)+([a-zA-Z0-9]{2,4})+$",
  27. true, errorMessage);
  28. }
  29. }