Use the Bean Validation API to validate the object for saving to the database using Hibernate. With English letters, everything is fine:
@Pattern(regexp="^[a-zA-Z]+$",message=" ") private String name;
When I wrote this:
@Pattern(regexp="^[a-z-A-Z-]+$", message=" ") private String name;
This does not work, make mistakes about incorrect data entries (Author name only from letters)
But how to add Russian letters to regexp?
Yes, the problem is in the form of Spring. When you delete the regular expression and enter the Russian text, it writes something like this to the database. Squad
source share