Validating email addresses with Bean Validation


References

/**
 * The regular expression for email addresses.
 */
public static final String EMAIL_ADDRESS_REGEXP =
    "^([_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*)"
    + "@([A-Za-z0-9]+(\\.[A-Za-z0-9]+)*)"
    + "(\\.[A-Za-z]{2,})$";

/**
 * email address.
 */
@Pattern(regexp = EMAIL_ADDRESS_REGEXP)
@Size(min = 6) // a@a.us
private String emailAddress;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s