In PHP, I can do:
$str = preg_replace("/(à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)/", 'a', $str);
means that in a string that contains any char like à, á, a, ả, ......will be replace by a.
How can I do the equivalence in Java?
In PHP, I can do:
$str = preg_replace("/(à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)/", 'a', $str);
means that in a string that contains any char like à, á, a, ả, ......will be replace by a.
How can I do the equivalence in Java?
You might want to use a much more generic solution for this problem:
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}+", "");
}
This removes all diacritical marks, from any letter, in any script.
Something very similar:
String output = input.replaceAll("[àáạảãâầấậẩẫăằắặẳẵ]","a");