I have an R function that tries to make up the first letter of each word "
proper = function(x){
gsub("(?<=\\b)([[:alpha:]])", "\\U\\1", x, perl = TRUE)
}
This works very well, but when I have a word with a Maori macron, for example Māori, I get the wrong capital letter.
> proper("Māori")
[1] "MāOri"
Obviously, the RE engine thinks that a macro āis a word boundary. I do not know why.
source
share