How to filter names (in unicode) using regular expressions


fun escapeSpecialCharacters(string: String): String {
return string.replace("[^\\p{L}\\p{N}\\p{P}\\p{Z}]".toRegex(), "_")
}

Unicode Regular Expressions