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 933B

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