I\'d like to use Hibernate Validator to validate some columns. The problem, as I understand, is that the \\w marker in java doesn\'t accept letters with accents on them.
I had more luck with:
\p{InCombiningDiacriticalMarks}+
In java I use the following method:
import java.text.Normalizer;
import java.text.Normalizer.Form;
public static String removeAccents(String text) {
return text == null ? null :
Normalizer.normalize(text, Form.NFD)
.replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
}
The Java regex documentation has a section on Unicode categories (search for "Classes for Unicode blocks and categories"). If you're just looking for letters, I think \p{L}
is the category you want.