Remove Accents - [ p{Incombiningdiacriticalmarks}] vs [ p{ASCII}]

Asked

Viewed 1,340 times

3

I created a code in Java to remove accents as the following:

private String removerAcentos(String texto) {
  texto = Normalizer.normalize(texto, Normalizer.Form.NFD);
  texto = texto.replaceAll("[\\p{InCombiningDiacriticalMarks}]", "");

  return texto;
}

I’d like to know the difference between [\\p{InCombiningDiacriticalMarks}] and [^\\p{ASCII}].

1 answer

3


[\\p{InCombiningDiacriticalMarks}] = Unicode characters only
[^\\p{ASCII}] = Nonlatinos

Browser other questions tagged

You are not signed in. Login or sign up in order to post.