I have a List<String>
that contains a list of emails, something like
{"[email protected]", "[email protected]"}
The problem is I don't really know how to create a @Pattern, and I want to put the condition that the pattern should only allow emails from list that ends with @gmail.com
. I used
@Pattern(regexp = "^(. )@(. )$")
for the case when I had a String, not a List.
CodePudding user response:
You may need to refer to the documentation of Container element constraints.
List<@Pattern(regexp = "^(. )@(gmail.com)$") String> mails;