Selected approach working fine for latin characters, with case insensitive option:
val lat = "udf".replaceAll("(?i)\bUDF\b","")
println(lat)
This function matches “UDF” and returns empty, as I expected.
But this one:
val cyr = "ая".replaceAll("(?i)\bАЯ\b"," ")
println(cyr)
returns “ая”, so it does not match word in upper case.
I there any way to solve this task?